home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 12 / BBS in a box XII-2.iso / Files II / Prog / D-G / Driver 2.2.sit / Driver 2.2 / driver.c next >
MacBinary  |  1993-10-23  |  22.6 KB  |  [TEXT/KAHL]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: MacBinary (archive/macBinary).

You can browse this item here: driver.c

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Sat Oct 23 18:13:40 1993, modified Sat Oct 23 18:13:40 1993, creator Think C, type ASCII, 21620 bytes "driver.c" , at 0x54f4 1300 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[KAHL]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 08 64 72 69 76 65 72 | 2e 63 00 00 00 00 00 00 |..driver|.c......|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4b 41 48 | 4c 00 00 00 00 00 00 00 |.TEXTKAH|L.......|
|00000050| 00 00 00 00 00 54 74 00 | 00 05 14 a8 ef 5d 14 a8 |.....Tt.|.....]..|
|00000060| ef 5d 14 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.]......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 98 9c 00 00 |........|........|
|00000080| 2f 2a 20 64 72 69 76 65 | 72 2e 63 20 20 2d 20 76 |/* drive|r.c - v|
|00000090| 65 72 73 69 6f 6e 20 32 | 2e 32 20 2d 20 4f 63 74 |ersion 2|.2 - Oct|
|000000a0| 6f 62 65 72 20 32 31 2c | 20 31 39 39 33 20 2a 2f |ober 21,| 1993 */|
|000000b0| 0d 0d 2f 2a 0d 20 2a 09 | 54 68 65 20 66 6f 6c 6c |../*. *.|The foll|
|000000c0| 6f 77 69 6e 67 20 63 6f | 64 65 20 69 73 20 74 6f |owing co|de is to|
|000000d0| 20 69 6e 73 74 61 6c 6c | 20 61 6e 64 20 72 65 6d | install| and rem|
|000000e0| 6f 76 65 20 52 41 4d 20 | 64 72 69 76 65 72 73 20 |ove RAM |drivers |
|000000f0| 69 6e 20 74 68 65 20 73 | 79 73 74 65 6d 0d 20 2a |in the s|ystem. *|
|00000100| 09 68 65 61 70 2e 20 57 | 72 69 74 74 65 6e 20 62 |.heap. W|ritten b|
|00000110| 79 20 50 65 74 65 20 52 | 65 73 6e 69 63 6b 20 77 |y Pete R|esnick w|
|00000120| 69 74 68 20 74 68 65 20 | 68 65 6c 70 20 6f 66 20 |ith the |help of |
|00000130| 4a 2e 20 47 65 61 67 61 | 6e 2c 20 4a 6f 65 20 48 |J. Geaga|n, Joe H|
|00000140| 6f 6c 74 2c 0d 20 2a 09 | 54 6f 6d 20 4a 6f 68 6e |olt,. *.|Tom John|
|00000150| 73 6f 6e 2c 20 4d 69 63 | 68 61 65 6c 20 41 2e 20 |son, Mic|hael A. |
|00000160| 4c 69 62 65 73 2c 20 43 | 68 61 72 6c 65 73 20 4d |Libes, C|harles M|
|00000170| 61 72 74 69 6e 2c 20 4a | 6f 68 6e 20 4e 6f 72 73 |artin, J|ohn Nors|
|00000180| 74 61 64 2c 20 50 68 69 | 6c 0d 20 2a 09 53 68 61 |tad, Phi|l. *.Sha|
|00000190| 70 69 72 6f 2c 20 45 72 | 69 63 20 42 72 61 75 6e |piro, Er|ic Braun|
|000001a0| 2c 20 44 61 76 69 64 20 | 42 72 6f 77 6e 20 61 6e |, David |Brown an|
|000001b0| 64 20 4d 61 74 74 68 69 | 61 73 20 55 72 6c 69 63 |d Matthi|as Urlic|
|000001c0| 68 73 2e 20 46 65 65 6c | 20 66 72 65 65 20 74 6f |hs. Feel| free to|
|000001d0| 0d 20 2a 09 75 73 65 20 | 74 68 69 73 20 69 6e 20 |. *.use |this in |
|000001e0| 79 6f 75 72 20 63 6f 64 | 65 2c 20 74 68 6f 75 67 |your cod|e, thoug|
|000001f0| 68 20 49 20 64 6f 20 61 | 73 6b 20 74 68 61 74 20 |h I do a|sk that |
|00000200| 79 6f 75 20 67 69 76 65 | 20 63 72 65 64 69 74 2e |you give| credit.|
|00000210| 20 50 6c 65 61 73 65 0d | 20 2a 09 72 65 70 6f 72 | Please.| *.repor|
|00000220| 74 20 61 6e 79 20 62 75 | 67 73 20 74 6f 20 50 65 |t any bu|gs to Pe|
|00000230| 74 65 20 52 65 73 6e 69 | 63 6b 20 2d 20 72 65 73 |te Resni|ck - res|
|00000240| 6e 69 63 6b 40 63 6f 67 | 73 63 69 2e 75 69 75 63 |nick@cog|sci.uiuc|
|00000250| 2e 65 64 75 2e 20 50 6c | 65 61 73 65 20 72 65 61 |.edu. Pl|ease rea|
|00000260| 64 0d 20 2a 09 74 68 65 | 20 52 45 41 44 4d 45 20 |d. *.the| README |
|00000270| 66 69 6c 65 20 61 6e 64 | 20 63 68 65 63 6b 20 64 |file and| check d|
|00000280| 65 66 69 6e 65 73 20 69 | 6e 20 64 72 76 72 69 6e |efines i|n drvrin|
|00000290| 63 6c 75 64 65 73 2e 68 | 20 62 65 66 6f 72 65 20 |cludes.h| before |
|000002a0| 79 6f 75 20 75 73 65 0d | 20 2a 09 74 68 69 73 20 |you use.| *.this |
|000002b0| 63 6f 64 65 21 21 0d 20 | 2a 0d 20 2a 09 43 68 61 |code!!. |*. *.Cha|
|000002c0| 6e 67 65 20 4c 6f 67 0d | 20 2a 09 2d 2d 2d 2d 2d |nge Log.| *.-----|
|000002d0| 2d 2d 2d 2d 2d 0d 20 2a | 09 44 61 74 65 3a 09 09 |-----. *|.Date:..|
|000002e0| 43 68 61 6e 67 65 3a 09 | 09 09 09 09 09 09 09 09 |Change:.|........|
|000002f0| 09 09 09 57 68 6f 3a 0d | 20 2a 09 2d 2d 2d 2d 2d |...Who:.| *.-----|
|00000300| 09 09 2d 2d 2d 2d 2d 2d | 2d 09 09 09 09 09 09 09 |..------|-.......|
|00000310| 09 09 09 09 09 2d 2d 2d | 2d 0d 20 2a 09 36 2f 32 |.....---|-. *.6/2|
|00000320| 2f 39 32 09 09 43 68 61 | 6e 67 65 64 20 54 68 69 |/92..Cha|nged Thi|
|00000330| 6e 6b 43 6c 65 61 6e 75 | 70 20 73 6f 20 74 68 61 |nkCleanu|p so tha|
|00000340| 74 20 69 74 20 63 6f 6d | 70 69 6c 65 73 20 61 6e |t it com|piles an|
|00000350| 64 20 77 6f 72 6b 73 09 | 70 72 0d 20 2a 09 36 2f |d works.|pr. *.6/|
|00000360| 32 32 2f 39 32 09 09 43 | 6f 72 72 65 63 74 65 64 |22/92..C|orrected|
|00000370| 20 64 65 63 6c 61 72 61 | 74 69 6f 6e 20 6f 66 20 | declara|tion of |
|00000380| 44 69 73 61 62 6c 65 49 | 6e 74 65 72 72 75 70 74 |DisableI|nterrupt|
|00000390| 73 09 09 09 65 62 0d 20 | 2a 09 37 2f 31 2f 39 32 |s...eb. |*.7/1/92|
|000003a0| 09 09 43 6f 72 72 65 63 | 74 65 64 20 64 65 63 6c |..Correc|ted decl|
|000003b0| 61 72 61 74 69 6f 6e 20 | 6f 66 20 44 72 76 72 49 |aration |of DrvrI|
|000003c0| 6e 73 74 61 6c 6c 20 61 | 6e 64 20 44 72 76 72 52 |nstall a|nd DrvrR|
|000003d0| 65 6d 6f 76 65 09 65 62 | 2f 70 72 0d 20 2a 09 31 |emove.eb|/pr. *.1|
|000003e0| 30 2f 31 35 2f 39 32 09 | 43 68 61 6e 67 65 64 20 |0/15/92.|Changed |
|000003f0| 47 65 74 31 53 79 73 52 | 73 72 63 20 74 6f 20 47 |Get1SysR|src to G|
|00000400| 65 74 31 53 79 73 58 52 | 73 72 63 09 09 09 09 09 |et1SysXR|src.....|
|00000410| 70 72 0d 20 2a 09 31 30 | 2f 31 38 2f 39 32 09 47 |pr. *.10|/18/92.G|
|00000420| 6f 74 20 72 69 64 20 6f | 66 20 74 68 69 6e 6b 52 |ot rid o|f thinkR|
|00000430| 65 4f 70 65 6e 3b 20 6a | 75 73 74 20 72 65 74 75 |eOpen; j|ust retu|
|00000440| 72 6e 20 31 20 66 72 6f | 6d 20 63 6c 6f 73 65 09 |rn 1 fro|m close.|
|00000450| 70 72 0d 20 2a 09 09 09 | 09 46 69 78 65 64 20 75 |pr. *...|.Fixed u|
|00000460| 70 20 50 74 72 49 6e 5a | 6f 6e 65 20 74 6f 20 6d |p PtrInZ|one to m|
|00000470| 61 6b 65 20 69 74 20 61 | 20 6c 69 74 74 6c 65 20 |ake it a| little |
|00000480| 71 75 69 63 6b 65 72 09 | 09 70 72 0d 20 2a 09 31 |quicker.|.pr. *.1|
|00000490| 31 2f 36 2f 39 32 09 09 | 47 6f 74 20 72 69 64 20 |1/6/92..|Got rid |
|000004a0| 6f 66 20 61 75 74 6f 20 | 69 6e 69 74 69 61 6c 69 |of auto |initiali|
|000004b0| 7a 65 20 66 6f 72 20 6e | 65 77 43 6f 64 65 20 61 |ze for n|ewCode a|
|000004c0| 6e 64 20 6f 6c 64 43 6f | 64 65 09 70 72 0d 20 2a |nd oldCo|de.pr. *|
|000004d0| 09 09 09 09 43 68 61 6e | 67 65 64 20 50 42 78 78 |....Chan|ged PBxx|
|000004e0| 78 20 63 61 6c 6c 73 20 | 74 6f 20 50 42 78 78 78 |x calls |to PBxxx|
|000004f0| 53 79 6e 63 09 09 09 09 | 09 70 72 0d 20 2a 09 31 |Sync....|.pr. *.1|
|00000500| 31 2f 38 2f 39 32 09 09 | 41 20 6c 69 74 74 6c 65 |1/8/92..|A little|
|00000510| 20 63 6c 65 61 6e 75 70 | 3b 20 6d 6f 76 65 64 20 | cleanup|; moved |
|00000520| 61 20 66 65 77 20 74 68 | 69 6e 67 73 09 09 09 09 |a few th|ings....|
|00000530| 70 72 0d 20 2a 09 31 32 | 2f 31 37 2f 39 32 09 41 |pr. *.12|/17/92.A|
|00000540| 64 64 65 64 20 48 4e 6f | 50 75 72 67 65 20 74 6f |dded HNo|Purge to|
|00000550| 20 47 65 74 31 53 79 73 | 58 52 73 72 63 09 09 09 | Get1Sys|XRsrc...|
|00000560| 09 09 09 64 62 2f 70 72 | 0d 20 2a 09 31 2f 32 34 |...db/pr|. *.1/24|
|00000570| 2f 39 33 09 09 46 69 78 | 65 64 20 64 6f 75 62 6c |/93..Fix|ed doubl|
|00000580| 65 20 64 65 6c 65 74 69 | 6f 6e 20 6f 66 20 44 41 |e deleti|on of DA|
|00000590| 54 41 20 68 61 6e 64 6c | 65 20 61 6e 64 20 64 69 |TA handl|e and di|
|000005a0| 73 70 6f 73 65 09 64 62 | 2f 70 72 0d 20 2a 09 09 |spose.db|/pr. *..|
|000005b0| 09 09 6f 66 20 63 6f 64 | 65 20 68 61 6e 64 6c 65 |..of cod|e handle|
|000005c0| 20 2d 2d 20 6d 61 6a 6f | 72 20 63 68 61 6e 67 65 | -- majo|r change|
|000005d0| 73 20 74 6f 20 61 6c 6c | 20 54 68 69 6e 6b 58 58 |s to all| ThinkXX|
|000005e0| 58 0d 20 2a 09 09 09 09 | 72 6f 75 74 69 6e 65 73 |X. *....|routines|
|000005f0| 20 61 6e 64 20 54 48 49 | 4e 4b 50 72 6f 63 2e 63 | and THI|NKProc.c|
|00000600| 0d 20 2a 09 32 2f 35 2f | 39 33 09 09 4d 61 64 65 |. *.2/5/|93..Made|
|00000610| 20 44 72 69 76 65 72 41 | 76 61 69 6c 20 61 20 6c | DriverA|vail a l|
|00000620| 69 74 74 6c 65 20 6d 6f | 72 65 20 65 66 66 69 63 |ittle mo|re effic|
|00000630| 65 6e 74 09 09 09 09 70 | 72 0d 20 2a 09 32 2f 36 |ent....p|r. *.2/6|
|00000640| 2f 39 33 09 09 52 65 2d | 77 72 6f 74 65 20 61 6c |/93..Re-|wrote al|
|00000650| 6c 20 6f 66 20 74 68 65 | 20 54 68 69 6e 6b 20 72 |l of the| Think r|
|00000660| 6f 75 74 69 6e 65 73 20 | 61 6e 64 20 54 48 49 4e |outines |and THIN|
|00000670| 4b 50 72 6f 63 2e 63 09 | 70 72 0d 20 2a 09 09 09 |KProc.c.|pr. *...|
|00000680| 09 73 6f 20 74 68 61 74 | 20 74 68 65 20 54 48 49 |.so that| the THI|
|00000690| 4e 4b 20 70 72 6f 63 20 | 69 73 20 61 20 70 6f 69 |NK proc |is a poi|
|000006a0| 6e 74 65 72 20 69 6e 73 | 74 65 61 64 20 6f 66 20 |nter ins|tead of |
|000006b0| 61 0d 20 2a 09 09 09 09 | 68 61 6e 64 6c 65 20 28 |a. *....|handle (|
|000006c0| 6e 65 65 64 65 64 20 66 | 6f 72 20 6c 6f 63 6b 65 |needed f|or locke|
|000006d0| 64 20 64 72 69 76 65 72 | 73 29 2e 0d 20 2a 09 32 |d driver|s).. *.2|
|000006e0| 2f 32 33 2f 39 33 09 09 | 50 61 73 73 65 64 20 64 |/23/93..|Passed d|
|000006f0| 72 76 72 49 6e 73 74 46 | 6c 61 67 73 20 74 6f 20 |rvrInstF|lags to |
|00000700| 52 65 6d 6f 76 65 52 41 | 4d 44 72 69 76 65 72 09 |RemoveRA|MDriver.|
|00000710| 66 72 6f 6d 09 09 70 72 | 0d 20 2a 09 09 09 09 49 |from..pr|. *....I|
|00000720| 6e 73 74 61 6c 6c 52 41 | 4d 44 72 69 76 65 72 20 |nstallRA|MDriver |
|00000730| 65 72 72 6f 72 0d 20 2a | 09 31 30 2f 32 31 2f 39 |error. *|.10/21/9|
|00000740| 33 09 43 68 65 63 6b 20 | 66 6f 72 20 6e 69 6c 20 |3.Check |for nil |
|00000750| 68 61 6e 64 6c 65 73 20 | 69 6e 20 52 65 6d 6f 76 |handles |in Remov|
|00000760| 65 52 41 4d 44 72 69 76 | 65 72 09 09 09 70 72 0d |eRAMDriv|er...pr.|
|00000770| 20 2a 09 09 09 09 5a 65 | 72 6f 20 6f 75 74 20 63 | *....Ze|ro out c|
|00000780| 6c 6f 73 65 20 62 6c 6f | 63 6b 20 69 6e 20 52 65 |lose blo|ck in Re|
|00000790| 6d 6f 76 65 52 41 4d 44 | 72 69 76 65 72 0d 20 2a |moveRAMD|river. *|
|000007a0| 09 09 09 09 50 72 65 74 | 74 69 66 69 65 64 20 47 |....Pret|tified G|
|000007b0| 65 74 44 72 76 72 52 65 | 66 4e 75 6d 0d 20 2a 09 |etDrvrRe|fNum. *.|
|000007c0| 09 09 09 4d 6f 76 65 64 | 20 44 69 73 61 62 6c 65 |...Moved| Disable|
|000007d0| 49 6e 74 65 72 72 75 70 | 74 73 2c 20 52 65 73 65 |Interrup|ts, Rese|
|000007e0| 74 49 6e 74 65 72 72 75 | 70 74 73 2c 0d 20 2a 09 |tInterru|pts,. *.|
|000007f0| 09 09 09 44 72 76 72 49 | 6e 73 74 61 6c 6c 2c 20 |...DrvrI|nstall, |
|00000800| 61 6e 64 20 44 72 76 72 | 52 65 6d 6f 76 65 20 66 |and Drvr|Remove f|
|00000810| 72 6f 6d 20 64 72 69 76 | 65 72 2e 68 20 74 6f 0d |rom driv|er.h to.|
|00000820| 20 2a 09 09 09 09 64 72 | 76 72 69 6e 63 6c 75 64 | *....dr|vrinclud|
|00000830| 65 73 2e 68 0d 20 2a 09 | 09 09 09 09 0d 20 2a 2f |es.h. *.|..... */|
|00000840| 0d 0d 23 69 6e 63 6c 75 | 64 65 20 22 64 72 76 72 |..#inclu|de "drvr|
|00000850| 69 6e 63 6c 75 64 65 73 | 2e 68 22 09 09 2f 2a 20 |includes|.h"../* |
|00000860| 49 6e 74 65 72 6e 61 6c | 20 75 73 65 20 61 6e 64 |Internal| use and|
|00000870| 20 6f 74 68 65 72 20 69 | 6e 63 6c 75 64 65 20 66 | other i|nclude f|
|00000880| 69 6c 65 73 09 2a 2f 0d | 23 69 6e 63 6c 75 64 65 |iles.*/.|#include|
|00000890| 20 22 64 72 69 76 65 72 | 2e 68 22 09 09 09 09 2f | "driver|.h"..../|
|000008a0| 2a 20 54 6f 20 62 65 20 | 75 73 65 64 20 69 6e 20 |* To be |used in |
|000008b0| 79 6f 75 72 20 61 70 70 | 6c 69 63 61 74 69 6f 6e |your app|lication|
|000008c0| 09 09 2a 2f 0d 0d 2f 2a | 0d 20 2a 09 49 6e 73 74 |..*/../*|. *.Inst|
|000008d0| 61 6c 6c 52 41 4d 44 72 | 69 76 65 72 20 77 69 6c |allRAMDr|iver wil|
|000008e0| 6c 20 69 6e 73 74 61 6c | 6c 20 74 68 65 20 6e 61 |l instal|l the na|
|000008f0| 6d 65 64 20 64 72 69 76 | 65 72 20 69 6e 74 6f 20 |med driv|er into |
|00000900| 74 68 65 20 73 79 73 74 | 65 6d 20 68 65 61 70 0d |the syst|em heap.|
|00000910| 20 2a 09 72 65 74 75 72 | 6e 20 74 68 65 20 64 72 | *.retur|n the dr|
|00000920| 69 76 65 72 20 72 65 66 | 65 72 65 6e 63 65 20 6e |iver ref|erence n|
|00000930| 75 6d 62 65 72 20 69 6e | 20 72 65 66 4e 75 6d 2e |umber in| refNum.|
|00000940| 20 54 68 65 20 64 72 76 | 72 49 6e 73 74 46 6c 61 | The drv|rInstFla|
|00000950| 67 73 0d 20 2a 09 70 61 | 72 61 6d 65 74 65 72 20 |gs. *.pa|rameter |
|00000960| 28 64 65 66 69 6e 65 64 | 20 69 6e 20 64 72 69 76 |(defined| in driv|
|00000970| 65 72 2e 68 29 20 73 70 | 65 63 69 66 69 65 73 20 |er.h) sp|ecifies |
|00000980| 77 68 65 74 68 65 72 20 | 74 6f 20 63 61 6c 6c 20 |whether |to call |
|00000990| 74 68 65 0d 20 2a 09 64 | 72 69 76 65 72 27 73 20 |the. *.d|river's |
|000009a0| 6f 70 65 6e 20 72 6f 75 | 74 69 6e 65 2c 20 77 68 |open rou|tine, wh|
|000009b0| 65 74 68 65 72 20 74 68 | 65 20 64 72 69 76 65 72 |ether th|e driver|
|000009c0| 20 69 73 20 77 72 69 74 | 74 65 6e 20 69 6e 20 54 | is writ|ten in T|
|000009d0| 48 49 4e 4b 20 43 0d 20 | 2a 09 61 6e 64 20 74 68 |HINK C. |*.and th|
|000009e0| 65 72 65 66 6f 72 65 20 | 68 61 73 20 61 20 44 41 |erefore |has a DA|
|000009f0| 54 41 20 72 65 73 6f 75 | 72 63 65 2c 20 77 68 65 |TA resou|rce, whe|
|00000a00| 74 68 65 72 20 74 68 65 | 20 64 72 69 76 65 72 20 |ther the| driver |
|00000a10| 68 61 73 20 54 48 49 4e | 4b 20 43 27 73 0d 20 2a |has THIN|K C's. *|
|00000a20| 09 6d 75 6c 74 69 70 6c | 65 20 73 65 67 6d 65 6e |.multipl|e segmen|
|00000a30| 74 20 6f 70 74 69 6f 6e | 20 74 75 72 6e 65 64 20 |t option| turned |
|00000a40| 6f 6e 2c 20 61 6e 64 20 | 66 69 6e 61 6c 6c 79 20 |on, and |finally |
|00000a50| 77 68 65 74 68 65 72 20 | 74 68 65 20 64 72 69 76 |whether |the driv|
|00000a60| 65 72 0d 20 2a 09 69 73 | 20 77 72 69 74 74 65 6e |er. *.is| written|
|00000a70| 20 69 6e 20 54 48 49 4e | 4b 20 43 20 61 6e 64 20 | in THIN|K C and |
|00000a80| 63 61 6e 20 62 65 20 63 | 6c 6f 73 65 64 20 61 6e |can be c|losed an|
|00000a90| 64 20 74 68 65 6e 20 6f | 70 65 6e 65 64 20 61 67 |d then o|pened ag|
|00000aa0| 61 69 6e 2e 0d 20 2a 09 | 54 48 49 4e 4b 20 43 20 |ain.. *.|THINK C |
|00000ab0| 6d 61 6b 65 73 20 73 6f | 6d 65 20 61 73 73 75 6d |makes so|me assum|
|00000ac0| 70 74 69 6f 6e 73 20 61 | 62 6f 75 74 20 6f 77 6e |ptions a|bout own|
|00000ad0| 65 64 20 72 65 73 6f 75 | 72 63 65 73 20 62 65 69 |ed resou|rces bei|
|00000ae0| 6e 67 20 61 76 61 69 6c | 61 62 6c 65 0d 20 2a 09 |ng avail|able. *.|
|00000af0| 77 68 69 63 68 20 77 69 | 6c 6c 20 68 61 76 65 20 |which wi|ll have |
|00000b00| 74 6f 20 62 65 20 74 61 | 6b 65 6e 20 63 61 72 65 |to be ta|ken care|
|00000b10| 20 6f 66 2e 20 53 65 65 | 20 74 68 65 20 54 68 69 | of. See| the Thi|
|00000b20| 6e 6b 49 6e 73 74 61 6c | 6c 20 72 6f 75 74 69 6e |nkInstal|l routin|
|00000b30| 65 20 74 6f 0d 20 2a 09 | 73 65 65 20 68 6f 77 20 |e to. *.|see how |
|00000b40| 69 74 20 69 73 20 68 61 | 6e 64 6c 65 64 2e 0d 20 |it is ha|ndled.. |
|00000b50| 2a 2f 0d 20 0d 4f 53 45 | 72 72 20 49 6e 73 74 61 |*/. .OSE|rr Insta|
|00000b60| 6c 6c 52 41 4d 44 72 69 | 76 65 72 28 53 74 72 32 |llRAMDri|ver(Str2|
|00000b70| 35 35 20 64 72 76 72 4e | 61 6d 65 2c 20 73 68 6f |55 drvrN|ame, sho|
|00000b80| 72 74 20 2a 72 65 66 4e | 75 6d 2c 0d 20 20 20 20 |rt *refN|um,. |
|00000b90| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000ba0| 20 20 20 64 72 76 72 46 | 6c 61 67 42 69 74 73 20 | drvrF|lagBits |
|00000bb0| 64 72 76 72 49 6e 73 74 | 46 6c 61 67 73 29 0d 7b |drvrInst|Flags).{|
|00000bc0| 0d 09 72 65 67 69 73 74 | 65 72 20 44 72 69 76 65 |..regist|er Drive|
|00000bd0| 72 50 74 72 20 64 72 76 | 72 50 74 72 3b 0d 09 72 |rPtr drv|rPtr;..r|
|00000be0| 65 67 69 73 74 65 72 20 | 44 43 74 6c 50 74 72 20 |egister |DCtlPtr |
|00000bf0| 63 74 6c 45 6e 74 72 79 | 50 74 72 3b 0d 09 52 65 |ctlEntry|Ptr;..Re|
|00000c00| 73 54 79 70 65 20 72 73 | 72 63 54 79 70 65 3b 0d |sType rs|rcType;.|
|00000c10| 09 48 61 6e 64 6c 65 20 | 64 72 76 72 48 61 6e 64 |.Handle |drvrHand|
|00000c20| 6c 65 3b 0d 09 4f 53 45 | 72 72 20 65 72 72 43 6f |le;..OSE|rr errCo|
|00000c30| 64 65 3b 0d 09 73 68 6f | 72 74 20 72 73 72 63 49 |de;..sho|rt rsrcI|
|00000c40| 44 2c 20 75 6e 69 74 4e | 75 6d 3b 0d 09 49 4f 50 |D, unitN|um;..IOP|
|00000c50| 61 72 61 6d 20 6f 70 65 | 6e 42 6c 6f 63 6b 3b 0d |aram ope|nBlock;.|
|00000c60| 09 42 79 74 65 20 68 6e | 64 6c 53 74 61 74 65 3b |.Byte hn|dlState;|
|00000c70| 0d 09 0d 09 2f 2a 20 53 | 61 6e 69 74 79 20 63 68 |..../* S|anity ch|
|00000c80| 65 63 6b 20 74 68 65 20 | 66 6c 61 67 73 20 2a 2f |eck the |flags */|
|00000c90| 0d 09 69 66 28 21 28 64 | 72 76 72 49 6e 73 74 46 |..if(!(d|rvrInstF|
|00000ca0| 6c 61 67 73 20 26 20 74 | 68 69 6e 6b 44 41 54 41 |lags & t|hinkDATA|
|00000cb0| 29 20 26 26 20 28 64 72 | 76 72 49 6e 73 74 46 6c |) && (dr|vrInstFl|
|00000cc0| 61 67 73 20 26 20 74 68 | 69 6e 6b 4d 75 6c 53 65 |ags & th|inkMulSe|
|00000cd0| 67 29 29 0d 09 09 72 65 | 74 75 72 6e 28 70 61 72 |g))...re|turn(par|
|00000ce0| 61 6d 45 72 72 29 3b 0d | 0d 09 2f 2a 20 44 6f 6e |amErr);.|../* Don|
|00000cf0| 27 74 20 72 65 2d 69 6e | 73 74 61 6c 6c 20 61 20 |'t re-in|stall a |
|00000d00| 64 65 76 69 63 65 20 64 | 72 69 76 65 72 20 2a 2f |device d|river */|
|00000d10| 0d 09 69 66 28 47 65 74 | 44 72 76 72 52 65 66 4e |..if(Get|DrvrRefN|
|00000d20| 75 6d 28 64 72 76 72 4e | 61 6d 65 29 20 21 3d 20 |um(drvrN|ame) != |
|00000d30| 30 29 0d 09 09 72 65 74 | 75 72 6e 28 62 61 64 55 |0)...ret|urn(badU|
|00000d40| 6e 69 74 45 72 72 29 3b | 0d 0d 09 2f 2a 20 47 65 |nitErr);|.../* Ge|
|00000d50| 74 20 74 68 65 20 6e 65 | 77 20 75 6e 69 74 20 6e |t the ne|w unit n|
|00000d60| 75 6d 62 65 72 20 66 6f | 72 20 74 68 65 20 64 72 |umber fo|r the dr|
|00000d70| 69 76 65 72 20 2a 2f 0d | 09 65 72 72 43 6f 64 65 |iver */.|.errCode|
|00000d80| 20 3d 20 44 72 69 76 65 | 72 41 76 61 69 6c 28 26 | = Drive|rAvail(&|
|00000d90| 75 6e 69 74 4e 75 6d 29 | 3b 0d 09 69 66 28 65 72 |unitNum)|;..if(er|
|00000da0| 72 43 6f 64 65 20 21 3d | 20 6e 6f 45 72 72 29 0d |rCode !=| noErr).|
|00000db0| 09 09 72 65 74 75 72 6e | 28 65 72 72 43 6f 64 65 |..return|(errCode|
|00000dc0| 29 3b 0d 0d 09 2f 2a 09 | 47 65 74 20 74 68 65 20 |);.../*.|Get the |
|00000dd0| 64 72 69 76 65 72 20 72 | 65 73 6f 75 72 63 65 20 |driver r|esource |
|00000de0| 69 6e 20 74 68 65 20 73 | 79 73 74 65 6d 20 68 65 |in the s|ystem he|
|00000df0| 61 70 20 61 6e 64 20 6e | 6f 6e 2d 70 75 72 67 65 |ap and n|on-purge|
|00000e00| 61 62 6c 65 20 2a 2f 0d | 09 65 72 72 43 6f 64 65 |able */.|.errCode|
|00000e10| 20 3d 20 47 65 74 31 53 | 79 73 58 52 73 72 63 28 | = Get1S|ysXRsrc(|
|00000e20| 26 64 72 76 72 48 61 6e | 64 6c 65 2c 20 27 44 52 |&drvrHan|dle, 'DR|
|00000e30| 56 52 27 2c 20 30 2c 20 | 30 2c 20 64 72 76 72 4e |VR', 0, |0, drvrN|
|00000e40| 61 6d 65 29 3b 0d 09 69 | 66 28 65 72 72 43 6f 64 |ame);..i|f(errCod|
|00000e50| 65 20 21 3d 20 6e 6f 45 | 72 72 29 0d 09 09 72 65 |e != noE|rr)...re|
|00000e60| 74 75 72 6e 28 64 49 6e | 73 74 45 72 72 29 3b 0d |turn(dIn|stErr);.|
|00000e70| 09 0d 09 2f 2a 20 53 61 | 76 65 20 74 68 65 20 72 |.../* Sa|ve the r|
|00000e80| 65 73 6f 75 72 63 65 20 | 49 44 20 66 6f 72 20 6c |esource |ID for l|
|00000e90| 61 74 65 72 20 75 73 65 | 20 2a 2f 0d 09 47 65 74 |ater use| */..Get|
|00000ea0| 52 65 73 49 6e 66 6f 28 | 64 72 76 72 48 61 6e 64 |ResInfo(|drvrHand|
|00000eb0| 6c 65 2c 20 26 72 73 72 | 63 49 44 2c 20 26 72 73 |le, &rsr|cID, &rs|
|00000ec0| 72 63 54 79 70 65 2c 20 | 64 72 76 72 4e 61 6d 65 |rcType, |drvrName|
|00000ed0| 29 3b 0d 09 69 66 28 28 | 65 72 72 43 6f 64 65 20 |);..if((|errCode |
|00000ee0| 3d 20 52 65 73 45 72 72 | 6f 72 28 29 29 20 3d 3d |= ResErr|or()) ==|
|00000ef0| 20 6e 6f 45 72 72 29 20 | 7b 0d 09 09 2f 2a 20 4e | noErr) |{.../* N|
|00000f00| 6f 77 20 64 65 74 61 63 | 68 20 69 74 20 2a 2f 0d |ow detac|h it */.|
|00000f10| 09 09 44 65 74 61 63 68 | 52 65 73 6f 75 72 63 65 |..Detach|Resource|
|00000f20| 28 64 72 76 72 48 61 6e | 64 6c 65 29 3b 0d 09 09 |(drvrHan|dle);...|
|00000f30| 65 72 72 43 6f 64 65 20 | 3d 20 52 65 73 45 72 72 |errCode |= ResErr|
|00000f40| 6f 72 28 29 3b 0d 09 7d | 0d 09 0d 09 2f 2a 20 52 |or();..}|..../* R|
|00000f50| 65 74 75 72 6e 20 6f 6e | 20 65 72 72 6f 72 73 20 |eturn on| errors |
|00000f60| 2a 2f 0d 09 69 66 28 65 | 72 72 43 6f 64 65 20 21 |*/..if(e|rrCode !|
|00000f70| 3d 20 6e 6f 45 72 72 29 | 20 7b 0d 09 09 52 65 6c |= noErr)| {...Rel|
|00000f80| 65 61 73 65 52 65 73 6f | 75 72 63 65 28 64 72 76 |easeReso|urce(drv|
|00000f90| 72 48 61 6e 64 6c 65 29 | 3b 0d 09 09 72 65 74 75 |rHandle)|;...retu|
|00000fa0| 72 6e 28 65 72 72 43 6f | 64 65 29 3b 0d 09 7d 0d |rn(errCo|de);..}.|
|00000fb0| 09 0d 09 2f 2a 20 50 61 | 74 63 68 20 74 68 65 20 |.../* Pa|tch the |
|00000fc0| 64 72 69 76 65 72 20 69 | 66 20 77 65 20 61 72 65 |driver i|f we are|
|00000fd0| 20 75 73 69 6e 67 20 54 | 48 49 4e 4b 20 43 20 2a | using T|HINK C *|
|00000fe0| 2f 0d 09 69 66 28 64 72 | 76 72 49 6e 73 74 46 6c |/..if(dr|vrInstFl|
|00000ff0| 61 67 73 20 26 20 74 68 | 69 6e 6b 44 41 54 41 29 |ags & th|inkDATA)|
|00001000| 20 7b 0d 09 09 65 72 72 | 43 6f 64 65 20 3d 20 54 | {...err|Code = T|
|00001010| 68 69 6e 6b 49 6e 69 74 | 28 64 72 76 72 48 61 6e |hinkInit|(drvrHan|
|00001020| 64 6c 65 2c 20 72 73 72 | 63 49 44 2c 20 75 6e 69 |dle, rsr|cID, uni|
|00001030| 74 4e 75 6d 2c 20 64 72 | 76 72 49 6e 73 74 46 6c |tNum, dr|vrInstFl|
|00001040| 61 67 73 29 3b 0d 09 09 | 2f 2a 20 52 65 74 75 72 |ags);...|/* Retur|
|00001050| 6e 20 6f 6e 20 65 72 72 | 6f 72 73 20 2a 2f 0d 09 |n on err|ors */..|
|00001060| 09 69 66 28 65 72 72 43 | 6f 64 65 20 21 3d 20 6e |.if(errC|ode != n|
|00001070| 6f 45 72 72 29 20 7b 0d | 09 09 09 44 69 73 70 6f |oErr) {.|...Dispo|
|00001080| 73 48 61 6e 64 6c 65 28 | 64 72 76 72 48 61 6e 64 |sHandle(|drvrHand|
|00001090| 6c 65 29 3b 0d 09 09 09 | 72 65 74 75 72 6e 28 65 |le);....|return(e|
|000010a0| 72 72 43 6f 64 65 29 3b | 0d 09 09 7d 0d 09 7d 0d |rrCode);|...}..}.|
|000010b0| 09 0d 09 2f 2a 20 49 6e | 73 74 61 6c 6c 20 44 52 |.../* In|stall DR|
|000010c0| 56 52 20 77 69 74 68 20 | 74 68 65 20 72 65 66 4e |VR with |the refN|
|000010d0| 75 6d 2e 20 54 68 65 20 | 72 65 66 4e 75 6d 20 69 |um. The |refNum i|
|000010e0| 73 20 74 68 65 20 2d 28 | 75 6e 69 74 4e 75 6d 20 |s the -(|unitNum |
|000010f0| 2b 20 31 29 20 2a 2f 0d | 09 68 6e 64 6c 53 74 61 |+ 1) */.|.hndlSta|
|00001100| 74 65 20 3d 20 48 47 65 | 74 53 74 61 74 65 28 64 |te = HGe|tState(d|
|00001110| 72 76 72 48 61 6e 64 6c | 65 29 3b 0d 09 48 4c 6f |rvrHandl|e);..HLo|
|00001120| 63 6b 28 64 72 76 72 48 | 61 6e 64 6c 65 29 3b 0d |ck(drvrH|andle);.|
|00001130| 09 65 72 72 43 6f 64 65 | 20 3d 20 44 72 76 72 49 |.errCode| = DrvrI|
|00001140| 6e 73 74 61 6c 6c 28 64 | 72 76 72 48 61 6e 64 6c |nstall(d|rvrHandl|
|00001150| 65 2c 20 7e 75 6e 69 74 | 4e 75 6d 29 3b 0d 09 48 |e, ~unit|Num);..H|
|00001160| 53 65 74 53 74 61 74 65 | 28 64 72 76 72 48 61 6e |SetState|(drvrHan|
|00001170| 64 6c 65 2c 20 68 6e 64 | 6c 53 74 61 74 65 29 3b |dle, hnd|lState);|
|00001180| 0d 0d 09 2f 2a 20 43 6c | 65 61 6e 75 70 20 6f 6e |.../* Cl|eanup on|
|00001190| 20 65 72 72 6f 72 73 20 | 2a 2f 0d 09 69 66 28 65 | errors |*/..if(e|
|000011a0| 72 72 43 6f 64 65 20 21 | 3d 20 6e 6f 45 72 72 29 |rrCode !|= noErr)|
|000011b0| 20 7b 0d 09 09 69 66 28 | 64 72 76 72 49 6e 73 74 | {...if(|drvrInst|
|000011c0| 46 6c 61 67 73 20 26 20 | 74 68 69 6e 6b 44 41 54 |Flags & |thinkDAT|
|000011d0| 41 29 0d 09 09 09 54 68 | 69 6e 6b 43 6c 65 61 6e |A)....Th|inkClean|
|000011e0| 75 70 28 64 72 76 72 48 | 61 6e 64 6c 65 2c 20 74 |up(drvrH|andle, t|
|000011f0| 72 75 65 29 3b 0d 09 09 | 44 69 73 70 6f 73 48 61 |rue);...|DisposHa|
|00001200| 6e 64 6c 65 28 64 72 76 | 72 48 61 6e 64 6c 65 29 |ndle(drv|rHandle)|
|00001210| 3b 0d 09 09 72 65 74 75 | 72 6e 28 65 72 72 43 6f |;...retu|rn(errCo|
|00001220| 64 65 29 3b 0d 09 7d 0d | 09 0d 09 2f 2a 20 4d 6f |de);..}.|.../* Mo|
|00001230| 76 65 20 74 68 65 20 69 | 6d 70 6f 72 74 61 6e 74 |ve the i|mportant|
|00001240| 20 69 6e 66 6f 72 6d 61 | 74 69 6f 6e 20 74 6f 20 | informa|tion to |
|00001250| 74 68 65 20 64 72 69 76 | 65 72 20 65 6e 74 72 79 |the driv|er entry|
|00001260| 20 2a 2f 0d 09 63 74 6c | 45 6e 74 72 79 50 74 72 | */..ctl|EntryPtr|
|00001270| 20 3d 20 2a 28 47 65 74 | 44 43 74 6c 45 6e 74 72 | = *(Get|DCtlEntr|
|00001280| 79 28 7e 75 6e 69 74 4e | 75 6d 29 29 3b 0d 09 64 |y(~unitN|um));..d|
|00001290| 72 76 72 50 74 72 20 3d | 20 2a 28 44 72 69 76 65 |rvrPtr =| *(Drive|
|000012a0| 72 48 61 6e 64 6c 65 29 | 64 72 76 72 48 61 6e 64 |rHandle)|drvrHand|
|000012b0| 6c 65 3b 0d 09 63 74 6c | 45 6e 74 72 79 50 74 72 |le;..ctl|EntryPtr|
|000012c0| 2d 3e 64 43 74 6c 44 72 | 69 76 65 72 20 3d 20 28 |->dCtlDr|iver = (|
|000012d0| 50 74 72 29 64 72 76 72 | 48 61 6e 64 6c 65 3b 0d |Ptr)drvr|Handle;.|
|000012e0| 09 63 74 6c 45 6e 74 72 | 79 50 74 72 2d 3e 64 43 |.ctlEntr|yPtr->dC|
|000012f0| 74 6c 46 6c 61 67 73 20 | 3d 20 64 72 76 72 50 74 |tlFlags |= drvrPt|
|00001300| 72 2d 3e 64 72 76 72 46 | 6c 61 67 73 20 7c 20 64 |r->drvrF|lags | d|
|00001310| 52 41 4d 42 61 73 65 64 | 3b 0d 09 63 74 6c 45 6e |RAMBased|;..ctlEn|
|00001320| 74 72 79 50 74 72 2d 3e | 64 43 74 6c 44 65 6c 61 |tryPtr->|dCtlDela|
|00001330| 79 20 3d 20 64 72 76 72 | 50 74 72 2d 3e 64 72 76 |y = drvr|Ptr->drv|
|00001340| 72 44 65 6c 61 79 3b 0d | 09 63 74 6c 45 6e 74 72 |rDelay;.|.ctlEntr|
|00001350| 79 50 74 72 2d 3e 64 43 | 74 6c 45 4d 61 73 6b 20 |yPtr->dC|tlEMask |
|00001360| 3d 20 64 72 76 72 50 74 | 72 2d 3e 64 72 76 72 45 |= drvrPt|r->drvrE|
|00001370| 4d 61 73 6b 3b 0d 09 63 | 74 6c 45 6e 74 72 79 50 |Mask;..c|tlEntryP|
|00001380| 74 72 2d 3e 64 43 74 6c | 4d 65 6e 75 20 3d 20 64 |tr->dCtl|Menu = d|
|00001390| 72 76 72 50 74 72 2d 3e | 64 72 76 72 4d 65 6e 75 |rvrPtr->|drvrMenu|
|000013a0| 3b 0d 09 0d 09 2f 2a 20 | 4f 70 65 6e 20 74 68 65 |;..../* |Open the|
|000013b0| 20 64 72 69 76 65 72 20 | 2a 2f 0d 09 69 66 28 64 | driver |*/..if(d|
|000013c0| 72 76 72 49 6e 73 74 46 | 6c 61 67 73 20 26 20 6f |rvrInstF|lags & o|
|000013d0| 70 65 6e 29 20 7b 0d 09 | 09 6f 70 65 6e 42 6c 6f |pen) {..|.openBlo|
|000013e0| 63 6b 2e 69 6f 43 6f 6d | 70 6c 65 74 69 6f 6e 20 |ck.ioCom|pletion |
|000013f0| 3d 20 6e 69 6c 3b 0d 09 | 09 6f 70 65 6e 42 6c 6f |= nil;..|.openBlo|
|00001400| 63 6b 2e 69 6f 4e 61 6d | 65 50 74 72 20 3d 20 64 |ck.ioNam|ePtr = d|
|00001410| 72 76 72 4e 61 6d 65 3b | 0d 09 09 6f 70 65 6e 42 |rvrName;|...openB|
|00001420| 6c 6f 63 6b 2e 69 6f 50 | 65 72 6d 73 73 6e 20 3d |lock.ioP|ermssn =|
|00001430| 20 66 73 43 75 72 50 65 | 72 6d 3b 0d 09 09 65 72 | fsCurPe|rm;...er|
|00001440| 72 43 6f 64 65 20 3d 20 | 50 42 4f 70 65 6e 53 79 |rCode = |PBOpenSy|
|00001450| 6e 63 28 28 50 61 72 6d | 42 6c 6b 50 74 72 29 26 |nc((Parm|BlkPtr)&|
|00001460| 6f 70 65 6e 42 6c 6f 63 | 6b 29 3b 0d 09 7d 0d 09 |openBloc|k);..}..|
|00001470| 0d 09 2f 2a 20 49 66 20 | 61 6e 20 65 72 72 6f 72 |../* If |an error|
|00001480| 20 6f 63 63 75 72 72 65 | 64 20 64 75 72 69 6e 67 | occurre|d during|
|00001490| 20 74 68 65 20 6f 70 65 | 6e 2c 20 72 65 6d 6f 76 | the ope|n, remov|
|000014a0| 65 20 74 68 65 20 44 52 | 56 52 20 2a 2f 0d 09 69 |e the DR|VR */..i|
|000014b0| 66 28 65 72 72 43 6f 64 | 65 20 21 3d 20 6e 6f 45 |f(errCod|e != noE|
|000014c0| 72 72 29 0d 09 09 52 65 | 6d 6f 76 65 52 41 4d 44 |rr)...Re|moveRAMD|
|000014d0| 72 69 76 65 72 28 7e 75 | 6e 69 74 4e 75 6d 2c 20 |river(~u|nitNum, |
|000014e0| 64 72 76 72 49 6e 73 74 | 46 6c 61 67 73 29 3b 0d |drvrInst|Flags);.|
|000014f0| 09 65 6c 73 65 0d 09 09 | 2a 72 65 66 4e 75 6d 20 |.else...|*refNum |
|00001500| 3d 20 7e 75 6e 69 74 4e | 75 6d 3b 0d 09 72 65 74 |= ~unitN|um;..ret|
|00001510| 75 72 6e 28 65 72 72 43 | 6f 64 65 29 3b 0d 7d 0d |urn(errC|ode);.}.|
|00001520| 0d 2f 2a 0d 20 2a 09 52 | 65 6d 6f 76 65 52 41 4d |./*. *.R|emoveRAM|
|00001530| 44 72 69 76 65 72 20 72 | 65 6d 6f 76 65 73 20 74 |Driver r|emoves t|
|00001540| 68 65 20 64 72 69 76 65 | 72 20 69 6e 73 74 61 6c |he drive|r instal|
|00001550| 6c 65 64 20 69 6e 20 74 | 68 65 20 73 79 73 74 65 |led in t|he syste|
|00001560| 6d 20 68 65 61 70 20 62 | 79 0d 20 2a 09 49 6e 73 |m heap b|y. *.Ins|
|00001570| 74 61 6c 6c 52 41 4d 44 | 72 69 76 65 72 2e 20 50 |tallRAMD|river. P|
|00001580| 61 73 73 20 74 68 65 20 | 73 61 6d 65 20 66 6c 61 |ass the |same fla|
|00001590| 67 73 20 74 6f 20 52 65 | 6d 6f 76 65 52 41 4d 44 |gs to Re|moveRAMD|
|000015a0| 72 69 76 65 72 20 74 68 | 61 74 20 79 6f 75 0d 20 |river th|at you. |
|000015b0| 2a 09 64 69 64 20 74 6f | 20 49 6e 73 74 61 6c 6c |*.did to| Install|
|000015c0| 52 41 4d 44 72 69 76 65 | 72 2e 20 49 66 20 54 48 |RAMDrive|r. If TH|
|000015d0| 49 4e 4b 20 43 20 72 65 | 73 6f 75 72 63 65 73 20 |INK C re|sources |
|000015e0| 77 65 72 65 20 62 65 69 | 6e 67 20 75 73 65 64 2c |were bei|ng used,|
|000015f0| 0d 20 2a 09 74 68 65 79 | 20 77 69 6c 6c 20 62 65 |. *.they| will be|
|00001600| 20 72 65 6d 6f 76 65 64 | 2e 20 28 53 65 65 20 54 | removed|. (See T|
|00001610| 68 69 6e 6b 49 6e 69 74 | 20 61 6e 64 20 54 68 69 |hinkInit| and Thi|
|00001620| 6e 6b 43 6c 65 61 6e 75 | 70 29 0d 20 2a 2f 0d 0d |nkCleanu|p). */..|
|00001630| 4f 53 45 72 72 20 52 65 | 6d 6f 76 65 52 41 4d 44 |OSErr Re|moveRAMD|
|00001640| 72 69 76 65 72 28 73 68 | 6f 72 74 20 72 65 66 4e |river(sh|ort refN|
|00001650| 75 6d 2c 20 64 72 76 72 | 46 6c 61 67 42 69 74 73 |um, drvr|FlagBits|
|00001660| 20 64 72 76 72 49 6e 73 | 74 46 6c 61 67 73 29 0d | drvrIns|tFlags).|
|00001670| 7b 0d 09 4f 53 45 72 72 | 20 65 72 72 43 6f 64 65 |{..OSErr| errCode|
|00001680| 20 3d 20 6e 6f 45 72 72 | 3b 0d 09 48 61 6e 64 6c | = noErr|;..Handl|
|00001690| 65 20 64 72 76 72 48 61 | 6e 64 6c 65 2c 20 64 72 |e drvrHa|ndle, dr|
|000016a0| 76 72 53 74 6f 72 61 67 | 65 3b 0d 09 44 43 74 6c |vrStorag|e;..DCtl|
|000016b0| 48 61 6e 64 6c 65 20 63 | 74 6c 45 6e 74 72 79 48 |Handle c|tlEntryH|
|000016c0| 6e 64 6c 3b 0d 09 49 4f | 50 61 72 61 6d 20 63 6c |ndl;..IO|Param cl|
|000016d0| 6f 73 65 42 6c 6f 63 6b | 3b 0d 09 42 79 74 65 20 |oseBlock|;..Byte |
|000016e0| 68 6e 64 6c 53 74 61 74 | 65 3b 0d 09 0d 09 2f 2a |hndlStat|e;..../*|
|000016f0| 20 47 65 74 20 74 68 65 | 20 64 72 69 76 65 72 20 | Get the| driver |
|00001700| 63 6f 6e 74 72 6f 6c 20 | 65 6e 74 72 79 20 2a 2f |control |entry */|
|00001710| 0d 09 69 66 28 28 63 74 | 6c 45 6e 74 72 79 48 6e |..if((ct|lEntryHn|
|00001720| 64 6c 20 3d 20 47 65 74 | 44 43 74 6c 45 6e 74 72 |dl = Get|DCtlEntr|
|00001730| 79 28 72 65 66 4e 75 6d | 29 29 20 3d 3d 20 6e 69 |y(refNum|)) == ni|
|00001740| 6c 29 0d 09 09 72 65 74 | 75 72 6e 28 75 6e 69 74 |l)...ret|urn(unit|
|00001750| 45 6d 70 74 79 45 72 72 | 29 3b 0d 09 09 0d 09 2f |EmptyErr|);...../|
|00001760| 2a 20 43 68 65 63 6b 20 | 66 6f 72 20 6e 69 6c 20 |* Check |for nil |
|00001770| 68 61 6e 64 6c 65 20 2a | 2f 0d 09 69 66 28 2a 63 |handle *|/..if(*c|
|00001780| 74 6c 45 6e 74 72 79 48 | 6e 64 6c 20 3d 3d 20 6e |tlEntryH|ndl == n|
|00001790| 69 6c 29 0d 09 09 72 65 | 74 75 72 6e 28 6e 69 6c |il)...re|turn(nil|
|000017a0| 48 61 6e 64 6c 65 45 72 | 72 29 3b 0d 09 0d 09 2f |HandleEr|r);..../|
|000017b0| 2a 20 47 65 74 20 74 68 | 65 20 64 72 69 76 65 72 |* Get th|e driver|
|000017c0| 20 68 61 6e 64 6c 65 20 | 2a 2f 0d 09 64 72 76 72 | handle |*/..drvr|
|000017d0| 48 61 6e 64 6c 65 20 3d | 20 28 48 61 6e 64 6c 65 |Handle =| (Handle|
|000017e0| 29 28 2a 2a 63 74 6c 45 | 6e 74 72 79 48 6e 64 6c |)(**ctlE|ntryHndl|
|000017f0| 29 2e 64 43 74 6c 44 72 | 69 76 65 72 3b 0d 0d 09 |).dCtlDr|iver;...|
|00001800| 2f 2a 20 49 66 20 74 68 | 65 20 64 72 69 76 65 72 |/* If th|e driver|
|00001810| 20 69 73 20 6f 70 65 6e | 2c 20 63 6c 6f 73 65 20 | is open|, close |
|00001820| 69 74 20 2a 2f 0d 09 69 | 66 28 28 2a 2a 63 74 6c |it */..i|f((**ctl|
|00001830| 45 6e 74 72 79 48 6e 64 | 6c 29 2e 64 43 74 6c 46 |EntryHnd|l).dCtlF|
|00001840| 6c 61 67 73 20 26 20 64 | 4f 70 65 6e 65 64 29 20 |lags & d|Opened) |
|00001850| 7b 0d 09 09 63 6c 6f 73 | 65 42 6c 6f 63 6b 2e 69 |{...clos|eBlock.i|
|00001860| 6f 43 6f 6d 70 6c 65 74 | 69 6f 6e 20 3d 20 6e 69 |oComplet|ion = ni|
|00001870| 6c 3b 0d 09 09 63 6c 6f | 73 65 42 6c 6f 63 6b 2e |l;...clo|seBlock.|
|00001880| 69 6f 52 65 73 75 6c 74 | 20 3d 20 30 3b 0d 09 09 |ioResult| = 0;...|
|00001890| 63 6c 6f 73 65 42 6c 6f | 63 6b 2e 69 6f 4e 61 6d |closeBlo|ck.ioNam|
|000018a0| 65 50 74 72 20 3d 20 6e | 69 6c 3b 0d 09 09 63 6c |ePtr = n|il;...cl|
|000018b0| 6f 73 65 42 6c 6f 63 6b | 2e 69 6f 56 52 65 66 4e |oseBlock|.ioVRefN|
|000018c0| 75 6d 20 3d 20 30 3b 0d | 09 09 63 6c 6f 73 65 42 |um = 0;.|..closeB|
|000018d0| 6c 6f 63 6b 2e 69 6f 52 | 65 66 4e 75 6d 20 3d 20 |lock.ioR|efNum = |
|000018e0| 72 65 66 4e 75 6d 3b 0d | 09 09 63 6c 6f 73 65 42 |refNum;.|..closeB|
|000018f0| 6c 6f 63 6b 2e 69 6f 50 | 65 72 6d 73 73 6e 20 3d |lock.ioP|ermssn =|
|00001900| 20 30 3b 0d 09 09 69 66 | 28 28 65 72 72 43 6f 64 | 0;...if|((errCod|
|00001910| 65 20 3d 20 50 42 43 6c | 6f 73 65 53 79 6e 63 28 |e = PBCl|oseSync(|
|00001920| 28 50 61 72 6d 42 6c 6b | 50 74 72 29 26 63 6c 6f |(ParmBlk|Ptr)&clo|
|00001930| 73 65 42 6c 6f 63 6b 29 | 29 20 21 3d 20 6e 6f 45 |seBlock)|) != noE|
|00001940| 72 72 29 0d 09 09 09 72 | 65 74 75 72 6e 28 65 72 |rr)....r|eturn(er|
|00001950| 72 43 6f 64 65 29 3b 0d | 09 7d 0d 09 0d 09 2f 2a |rCode);.|.}..../*|
|00001960| 20 48 6f 6c 64 20 6f 6e | 74 6f 20 74 68 65 20 64 | Hold on|to the d|
|00001970| 72 69 76 65 72 20 73 74 | 6f 72 61 67 65 20 68 61 |river st|orage ha|
|00001980| 6e 64 6c 65 20 2a 2f 0d | 09 64 72 76 72 53 74 6f |ndle */.|.drvrSto|
|00001990| 72 61 67 65 20 3d 20 28 | 2a 2a 63 74 6c 45 6e 74 |rage = (|**ctlEnt|
|000019a0| 72 79 48 6e 64 6c 29 2e | 64 43 74 6c 53 74 6f 72 |ryHndl).|dCtlStor|
|000019b0| 61 67 65 3b 0d 09 0d 09 | 2f 2a 20 52 65 6d 6f 76 |age;....|/* Remov|
|000019c0| 65 20 74 68 65 20 64 72 | 69 76 65 72 20 2a 2f 0d |e the dr|iver */.|
|000019d0| 09 68 6e 64 6c 53 74 61 | 74 65 20 3d 20 48 47 65 |.hndlSta|te = HGe|
|000019e0| 74 53 74 61 74 65 28 64 | 72 76 72 48 61 6e 64 6c |tState(d|rvrHandl|
|000019f0| 65 29 3b 0d 09 48 4c 6f | 63 6b 28 64 72 76 72 48 |e);..HLo|ck(drvrH|
|00001a00| 61 6e 64 6c 65 29 3b 0d | 09 65 72 72 43 6f 64 65 |andle);.|.errCode|
|00001a10| 20 3d 20 44 72 76 72 52 | 65 6d 6f 76 65 28 72 65 | = DrvrR|emove(re|
|00001a20| 66 4e 75 6d 29 3b 0d 09 | 48 53 65 74 53 74 61 74 |fNum);..|HSetStat|
|00001a30| 65 28 64 72 76 72 48 61 | 6e 64 6c 65 2c 20 68 6e |e(drvrHa|ndle, hn|
|00001a40| 64 6c 53 74 61 74 65 29 | 3b 0d 09 0d 09 2f 2a 20 |dlState)|;..../* |
|00001a50| 52 65 74 75 72 6e 20 6f | 6e 20 65 72 72 6f 72 73 |Return o|n errors|
|00001a60| 20 2a 2f 0d 09 69 66 28 | 65 72 72 43 6f 64 65 20 | */..if(|errCode |
|00001a70| 21 3d 20 6e 6f 45 72 72 | 29 0d 09 09 72 65 74 75 |!= noErr|)...retu|
|00001a80| 72 6e 28 65 72 72 43 6f | 64 65 29 3b 0d 09 0d 09 |rn(errCo|de);....|
|00001a90| 2f 2a 20 44 6f 20 54 48 | 49 4e 4b 20 43 20 73 74 |/* Do TH|INK C st|
|00001aa0| 75 66 66 20 2a 2f 0d 09 | 69 66 28 64 72 76 72 49 |uff */..|if(drvrI|
|00001ab0| 6e 73 74 46 6c 61 67 73 | 20 26 20 74 68 69 6e 6b |nstFlags| & think|
|00001ac0| 44 41 54 41 29 0d 09 09 | 54 68 69 6e 6b 43 6c 65 |DATA)...|ThinkCle|
|00001ad0| 61 6e 75 70 28 64 72 76 | 72 48 61 6e 64 6c 65 2c |anup(drv|rHandle,|
|00001ae0| 20 64 72 76 72 53 74 6f | 72 61 67 65 20 21 3d 20 | drvrSto|rage != |
|00001af0| 6e 69 6c 29 3b 0d 0d 09 | 2f 2a 0d 09 20 2a 09 53 |nil);...|/*.. *.S|
|00001b00| 69 6e 63 65 20 74 68 65 | 20 64 72 69 76 65 72 20 |ince the| driver |
|00001b10| 68 61 73 20 62 65 65 6e | 20 64 65 74 61 63 68 65 |has been| detache|
|00001b20| 64 2c 20 69 74 20 77 69 | 6c 6c 20 68 61 76 65 20 |d, it wi|ll have |
|00001b30| 74 6f 20 62 65 20 64 69 | 73 70 6f 73 65 64 20 6f |to be di|sposed o|
|00001b40| 66 0d 09 20 2a 09 73 69 | 6e 63 65 20 44 72 76 72 |f.. *.si|nce Drvr|
|00001b50| 52 65 6d 6f 76 65 20 6a | 75 73 74 20 64 6f 65 73 |Remove j|ust does|
|00001b60| 20 61 20 52 65 6c 65 61 | 73 65 52 65 73 6f 75 72 | a Relea|seResour|
|00001b70| 63 65 20 6f 6e 20 74 68 | 65 20 68 61 6e 64 6c 65 |ce on th|e handle|
|00001b80| 2e 0d 09 20 2a 2f 0d 09 | 69 66 28 64 72 76 72 48 |... */..|if(drvrH|
|00001b90| 61 6e 64 6c 65 20 21 3d | 20 6e 69 6c 29 0d 09 09 |andle !=| nil)...|
|00001ba0| 44 69 73 70 6f 73 48 61 | 6e 64 6c 65 28 64 72 76 |DisposHa|ndle(drv|
|00001bb0| 72 48 61 6e 64 6c 65 29 | 3b 0d 0d 09 72 65 74 75 |rHandle)|;...retu|
|00001bc0| 72 6e 28 6e 6f 45 72 72 | 29 3b 0d 7d 0d 0d 2f 2a |rn(noErr|);.}../*|
|00001bd0| 0d 20 2a 09 47 65 74 44 | 72 76 72 52 65 66 4e 75 |. *.GetD|rvrRefNu|
|00001be0| 6d 20 73 69 6d 70 6c 79 | 20 73 65 61 72 63 68 65 |m simply| searche|
|00001bf0| 73 20 74 68 72 6f 75 67 | 68 20 65 61 63 68 20 64 |s throug|h each d|
|00001c00| 72 69 76 65 72 20 63 6f | 6e 74 72 6f 6c 20 65 6e |river co|ntrol en|
|00001c10| 74 72 79 0d 20 2a 09 66 | 6f 72 20 61 20 64 72 69 |try. *.f|or a dri|
|00001c20| 76 65 72 20 77 69 74 68 | 20 74 68 65 20 73 61 6d |ver with| the sam|
|00001c30| 65 20 6e 61 6d 65 20 61 | 73 20 74 68 61 74 20 73 |e name a|s that s|
|00001c40| 70 65 63 69 66 69 65 64 | 20 69 6e 20 64 72 76 72 |pecified| in drvr|
|00001c50| 4e 61 6d 65 2e 0d 20 2a | 09 49 66 20 66 6f 75 6e |Name.. *|.If foun|
|00001c60| 64 2c 20 74 68 65 20 72 | 65 66 65 72 65 6e 63 65 |d, the r|eference|
|00001c70| 20 6e 75 6d 62 65 72 20 | 69 73 20 72 65 74 75 72 | number |is retur|
|00001c80| 6e 65 64 2e 20 49 66 20 | 6e 6f 20 64 72 69 76 65 |ned. If |no drive|
|00001c90| 72 20 69 73 20 66 6f 75 | 6e 64 0d 20 2a 09 62 79 |r is fou|nd. *.by|
|00001ca0| 20 74 68 61 74 20 6e 61 | 6d 65 2c 20 30 20 69 73 | that na|me, 0 is|
|00001cb0| 20 72 65 74 75 72 6e 65 | 64 2e 20 52 65 61 64 73 | returne|d. Reads|
|00001cc0| 20 74 68 65 20 6c 6f 77 | 2d 6d 65 6d 6f 72 79 20 | the low|-memory |
|00001cd0| 67 6c 6f 62 61 6c 20 55 | 6e 69 74 4e 74 72 79 43 |global U|nitNtryC|
|00001ce0| 6e 74 2e 0d 20 2a 2f 0d | 0d 73 68 6f 72 74 20 47 |nt.. */.|.short G|
|00001cf0| 65 74 44 72 76 72 52 65 | 66 4e 75 6d 28 53 74 72 |etDrvrRe|fNum(Str|
|00001d00| 32 35 35 20 64 72 76 72 | 4e 61 6d 65 29 0d 7b 0d |255 drvr|Name).{.|
|00001d10| 09 73 68 6f 72 74 20 75 | 6e 69 74 4e 75 6d 3b 0d |.short u|nitNum;.|
|00001d20| 09 44 43 74 6c 50 74 72 | 20 63 75 72 44 43 74 6c |.DCtlPtr| curDCtl|
|00001d30| 50 74 72 2c 20 2a 63 75 | 72 44 43 74 6c 48 6e 64 |Ptr, *cu|rDCtlHnd|
|00001d40| 6c 2c 20 2a 2a 55 54 61 | 62 6c 65 45 6e 74 72 79 |l, **UTa|bleEntry|
|00001d50| 3b 0d 09 44 72 69 76 65 | 72 50 74 72 20 63 75 72 |;..Drive|rPtr cur|
|00001d60| 44 72 76 72 50 74 72 3b | 0d 09 0d 09 2f 2a 20 53 |DrvrPtr;|..../* S|
|00001d70| 74 61 72 74 20 61 74 20 | 55 54 61 62 6c 65 42 61 |tart at |UTableBa|
|00001d80| 73 65 20 2a 2f 0d 09 55 | 54 61 62 6c 65 45 6e 74 |se */..U|TableEnt|
|00001d90| 72 79 20 3d 20 55 54 41 | 42 4c 45 42 41 53 45 3b |ry = UTA|BLEBASE;|
|00001da0| 0d 09 0d 09 2f 2a 20 57 | 61 6c 6b 20 74 68 72 6f |..../* W|alk thro|
|00001db0| 75 67 68 20 74 68 65 20 | 55 6e 69 74 20 54 61 62 |ugh the |Unit Tab|
|00001dc0| 6c 65 20 2a 2f 0d 09 66 | 6f 72 28 75 6e 69 74 4e |le */..f|or(unitN|
|00001dd0| 75 6d 20 3d 20 30 3b 20 | 75 6e 69 74 4e 75 6d 20 |um = 0; |unitNum |
|00001de0| 3c 20 55 4e 49 54 4e 54 | 52 59 43 4e 54 3b 20 2b |< UNITNT|RYCNT; +|
|00001df0| 2b 75 6e 69 74 4e 75 6d | 29 20 7b 0d 09 0d 09 09 |+unitNum|) {.....|
|00001e00| 2f 2a 20 47 65 74 20 74 | 68 65 20 65 6e 74 72 79 |/* Get t|he entry|
|00001e10| 20 61 74 20 74 68 69 73 | 20 70 6f 69 6e 74 20 69 | at this| point i|
|00001e20| 6e 20 74 68 65 20 75 6e | 69 74 20 74 61 62 6c 65 |n the un|it table|
|00001e30| 20 61 6e 64 20 69 6e 63 | 72 65 6d 65 6e 74 20 2a | and inc|rement *|
|00001e40| 2f 0d 09 09 63 75 72 44 | 43 74 6c 48 6e 64 6c 20 |/...curD|CtlHndl |
|00001e50| 3d 20 2a 55 54 61 62 6c | 65 45 6e 74 72 79 2b 2b |= *UTabl|eEntry++|
|00001e60| 3b 0d 09 09 0d 09 09 69 | 66 28 63 75 72 44 43 74 |;......i|f(curDCt|
|00001e70| 6c 48 6e 64 6c 20 21 3d | 20 6e 69 6c 29 20 7b 0d |lHndl !=| nil) {.|
|00001e80| 0d 09 09 09 2f 2a 20 44 | 65 72 65 66 65 72 65 6e |..../* D|ereferen|
|00001e90| 63 65 20 74 68 65 20 63 | 6f 6e 74 72 6f 6c 20 65 |ce the c|ontrol e|
|00001ea0| 6e 74 72 79 20 2a 2f 0d | 09 09 09 63 75 72 44 43 |ntry */.|...curDC|
|00001eb0| 74 6c 50 74 72 20 3d 20 | 2a 63 75 72 44 43 74 6c |tlPtr = |*curDCtl|
|00001ec0| 48 6e 64 6c 3b 0d 09 09 | 09 0d 09 09 09 2f 2a 20 |Hndl;...|...../* |
|00001ed0| 47 65 74 20 74 68 65 20 | 70 6f 69 6e 74 65 72 20 |Get the |pointer |
|00001ee0| 74 6f 20 74 68 65 20 64 | 72 69 76 65 72 20 2a 2f |to the d|river */|
|00001ef0| 0d 09 09 09 63 75 72 44 | 72 76 72 50 74 72 20 3d |....curD|rvrPtr =|
|00001f00| 20 28 44 72 69 76 65 72 | 50 74 72 29 63 75 72 44 | (Driver|Ptr)curD|
|00001f10| 43 74 6c 50 74 72 2d 3e | 64 43 74 6c 44 72 69 76 |CtlPtr->|dCtlDriv|
|00001f20| 65 72 3b 0d 0d 09 09 09 | 2f 2a 20 49 66 20 74 68 |er;.....|/* If th|
|00001f30| 69 73 20 69 73 20 61 20 | 52 41 4d 20 64 72 69 76 |is is a |RAM driv|
|00001f40| 65 72 2c 20 69 74 27 73 | 20 61 20 68 61 6e 64 6c |er, it's| a handl|
|00001f50| 65 2e 20 52 4f 4d 20 69 | 73 20 61 20 70 6f 69 6e |e. ROM i|s a poin|
|00001f60| 74 65 72 20 2a 2f 0d 09 | 09 09 69 66 28 28 63 75 |ter */..|..if((cu|
|00001f70| 72 44 43 74 6c 50 74 72 | 2d 3e 64 43 74 6c 46 6c |rDCtlPtr|->dCtlFl|
|00001f80| 61 67 73 20 26 20 64 52 | 41 4d 42 61 73 65 64 29 |ags & dR|AMBased)|
|00001f90| 20 26 26 20 28 63 75 72 | 44 72 76 72 50 74 72 20 | && (cur|DrvrPtr |
|00001fa0| 21 3d 20 6e 69 6c 29 29 | 0d 09 09 09 09 63 75 72 |!= nil))|.....cur|
|00001fb0| 44 72 76 72 50 74 72 20 | 3d 20 2a 28 44 72 69 76 |DrvrPtr |= *(Driv|
|00001fc0| 65 72 50 74 72 20 2a 29 | 63 75 72 44 72 76 72 50 |erPtr *)|curDrvrP|
|00001fd0| 74 72 3b 0d 09 09 09 0d | 09 09 09 2f 2a 20 44 6f |tr;.....|.../* Do|
|00001fe0| 65 73 20 74 68 65 20 64 | 72 69 76 65 72 20 6e 61 |es the d|river na|
|00001ff0| 6d 65 20 6d 61 74 63 68 | 3f 20 2a 2f 0d 09 09 09 |me match|? */....|
|00002000| 69 66 28 63 75 72 44 72 | 76 72 50 74 72 20 21 3d |if(curDr|vrPtr !=|
|00002010| 20 6e 69 6c 29 0d 09 09 | 09 09 69 66 28 45 71 75 | nil)...|..if(Equ|
|00002020| 61 6c 53 74 72 69 6e 67 | 28 64 72 76 72 4e 61 6d |alString|(drvrNam|
|00002030| 65 2c 20 63 75 72 44 72 | 76 72 50 74 72 2d 3e 64 |e, curDr|vrPtr->d|
|00002040| 72 76 72 4e 61 6d 65 2c | 0d 09 09 09 09 20 20 20 |rvrName,|..... |
|00002050| 20 20 20 20 20 20 20 20 | 20 20 20 20 66 61 6c 73 | | fals|
|00002060| 65 2c 20 74 72 75 65 29 | 29 0d 09 09 09 09 09 72 |e, true)|)......r|
|00002070| 65 74 75 72 6e 28 7e 75 | 6e 69 74 4e 75 6d 29 3b |eturn(~u|nitNum);|
|00002080| 0d 09 09 7d 0d 09 7d 0d | 09 72 65 74 75 72 6e 28 |...}..}.|.return(|
|00002090| 30 29 3b 0d 7d 0d 0d 2f | 2a 0d 20 2a 09 47 72 6f |0);.}../|*. *.Gro|
|000020a0| 77 55 54 61 62 6c 65 20 | 69 6e 63 72 65 61 73 65 |wUTable |increase|
|000020b0| 73 20 74 68 65 20 73 69 | 7a 65 20 6f 66 20 74 68 |s the si|ze of th|
|000020c0| 65 20 64 72 69 76 65 72 | 20 75 6e 69 74 20 74 61 |e driver| unit ta|
|000020d0| 62 6c 65 20 62 79 20 6e | 65 77 45 6e 74 72 69 65 |ble by n|ewEntrie|
|000020e0| 73 2e 0d 20 2a 09 49 6e | 74 65 72 72 75 70 74 73 |s.. *.In|terrupts|
|000020f0| 20 6d 75 73 74 20 62 65 | 20 64 69 73 61 62 6c 65 | must be| disable|
|00002100| 64 20 64 75 72 69 6e 67 | 20 74 68 69 73 20 6f 70 |d during| this op|
|00002110| 65 72 61 74 69 6f 6e 2e | 20 43 68 61 6e 67 65 73 |eration.| Changes|
|00002120| 20 74 68 65 0d 20 2a 09 | 6c 6f 77 2d 6d 65 6d 6f | the. *.|low-memo|
|00002130| 72 79 20 67 6c 6f 62 61 | 6c 73 20 55 54 61 62 6c |ry globa|ls UTabl|
|00002140| 65 42 61 73 65 20 61 6e | 64 20 55 6e 69 74 4e 74 |eBase an|d UnitNt|
|00002150| 72 79 43 6e 74 2e 0d 20 | 2a 2f 0d 0d 4f 53 45 72 |ryCnt.. |*/..OSEr|
|00002160| 72 20 47 72 6f 77 55 54 | 61 62 6c 65 28 73 68 6f |r GrowUT|able(sho|
|00002170| 72 74 20 6e 65 77 45 6e | 74 72 69 65 73 29 0d 7b |rt newEn|tries).{|
|00002180| 0d 09 44 43 74 6c 48 61 | 6e 64 6c 65 20 2a 6e 65 |..DCtlHa|ndle *ne|
|00002190| 77 55 54 61 62 6c 65 42 | 61 73 65 3b 0d 09 73 68 |wUTableB|ase;..sh|
|000021a0| 6f 72 74 20 6f 6c 64 53 | 52 3b 0d 09 0d 09 2f 2a |ort oldS|R;..../*|
|000021b0| 20 4d 61 6b 65 20 72 6f | 6f 6d 20 66 6f 72 20 74 | Make ro|om for t|
|000021c0| 68 65 20 6e 65 77 20 55 | 6e 69 74 20 54 61 62 6c |he new U|nit Tabl|
|000021d0| 65 20 2a 2f 0d 09 6e 65 | 77 55 54 61 62 6c 65 42 |e */..ne|wUTableB|
|000021e0| 61 73 65 20 3d 0d 09 09 | 28 44 43 74 6c 48 61 6e |ase =...|(DCtlHan|
|000021f0| 64 6c 65 20 2a 29 4e 65 | 77 50 74 72 53 79 73 43 |dle *)Ne|wPtrSysC|
|00002200| 6c 65 61 72 28 28 6c 6f | 6e 67 29 28 28 55 4e 49 |lear((lo|ng)((UNI|
|00002210| 54 4e 54 52 59 43 4e 54 | 20 2b 20 6e 65 77 45 6e |TNTRYCNT| + newEn|
|00002220| 74 72 69 65 73 29 20 2a | 0d 09 09 20 20 20 20 20 |tries) *|... |
|00002230| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002240| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 73 | | s|
|00002250| 69 7a 65 6f 66 28 44 43 | 74 6c 48 61 6e 64 6c 65 |izeof(DC|tlHandle|
|00002260| 29 29 29 3b 0d 09 69 66 | 28 4d 65 6d 45 72 72 6f |)));..if|(MemErro|
|00002270| 72 28 29 20 21 3d 20 6e | 6f 45 72 72 29 0d 09 09 |r() != n|oErr)...|
|00002280| 72 65 74 75 72 6e 28 4d | 65 6d 45 72 72 6f 72 28 |return(M|emError(|
|00002290| 29 29 3b 0d 0d 09 2f 2a | 20 41 6e 79 20 44 65 76 |));.../*| Any Dev|
|000022a0| 69 63 65 20 4d 61 6e 61 | 67 65 72 20 61 63 74 69 |ice Mana|ger acti|
|000022b0| 6f 6e 20 6e 6f 77 20 77 | 6f 75 6c 64 20 62 65 20 |on now w|ould be |
|000022c0| 62 61 64 21 20 2a 2f 0d | 09 6f 6c 64 53 52 20 3d |bad! */.|.oldSR =|
|000022d0| 20 44 69 73 61 62 6c 65 | 49 6e 74 65 72 72 75 70 | Disable|Interrup|
|000022e0| 74 73 28 29 3b 0d 09 0d | 09 2f 2a 20 4d 6f 76 65 |ts();...|./* Move|
|000022f0| 20 74 68 65 20 6f 6c 64 | 20 55 6e 69 74 20 54 61 | the old| Unit Ta|
|00002300| 62 6c 65 20 74 6f 20 74 | 68 65 20 6e 65 77 20 55 |ble to t|he new U|
|00002310| 6e 69 74 20 54 61 62 6c | 65 20 2a 2f 0d 09 42 6c |nit Tabl|e */..Bl|
|00002320| 6f 63 6b 4d 6f 76 65 28 | 55 54 41 42 4c 45 42 41 |ockMove(|UTABLEBA|
|00002330| 53 45 2c 20 6e 65 77 55 | 54 61 62 6c 65 42 61 73 |SE, newU|TableBas|
|00002340| 65 2c 0d 09 20 20 20 20 | 20 20 20 20 20 20 28 6c |e,.. | (l|
|00002350| 6f 6e 67 29 28 55 4e 49 | 54 4e 54 52 59 43 4e 54 |ong)(UNI|TNTRYCNT|
|00002360| 20 2a 20 73 69 7a 65 6f | 66 28 44 43 74 6c 48 61 | * sizeo|f(DCtlHa|
|00002370| 6e 64 6c 65 29 29 29 3b | 0d 09 44 69 73 70 6f 73 |ndle)));|..Dispos|
|00002380| 50 74 72 28 28 50 74 72 | 29 55 54 41 42 4c 45 42 |Ptr((Ptr|)UTABLEB|
|00002390| 41 53 45 29 3b 0d 09 55 | 54 41 42 4c 45 42 41 53 |ASE);..U|TABLEBAS|
|000023a0| 45 20 3d 20 6e 65 77 55 | 54 61 62 6c 65 42 61 73 |E = newU|TableBas|
|000023b0| 65 3b 0d 09 55 4e 49 54 | 4e 54 52 59 43 4e 54 20 |e;..UNIT|NTRYCNT |
|000023c0| 2b 3d 20 6e 65 77 45 6e | 74 72 69 65 73 3b 0d 09 |+= newEn|tries;..|
|000023d0| 0d 09 2f 2a 20 52 65 6e | 61 62 6c 65 20 69 6e 74 |../* Ren|able int|
|000023e0| 65 72 72 75 70 74 73 20 | 2a 2f 0d 09 52 65 73 65 |errupts |*/..Rese|
|000023f0| 74 53 74 61 74 75 73 52 | 65 67 69 73 74 65 72 28 |tStatusR|egister(|
|00002400| 6f 6c 64 53 52 29 3b 0d | 0d 09 72 65 74 75 72 6e |oldSR);.|..return|
|00002410| 28 6e 6f 45 72 72 29 3b | 0d 7d 0d 0d 2f 2a 0d 20 |(noErr);|.}../*. |
|00002420| 2a 09 44 72 69 76 65 72 | 41 76 61 69 6c 20 66 69 |*.Driver|Avail fi|
|00002430| 6e 64 73 20 74 68 65 20 | 66 69 72 73 74 20 61 76 |nds the |first av|
|00002440| 61 69 6c 61 62 6c 65 20 | 73 6c 6f 74 20 69 6e 20 |ailable |slot in |
|00002450| 74 68 65 20 75 6e 69 74 | 20 74 61 62 6c 65 20 74 |the unit| table t|
|00002460| 6f 0d 20 2a 09 69 6e 73 | 74 61 6c 6c 20 74 68 65 |o. *.ins|tall the|
|00002470| 20 6e 65 77 20 64 65 76 | 69 63 65 20 64 72 69 76 | new dev|ice driv|
|00002480| 65 72 2e 20 49 74 20 77 | 69 6c 6c 20 63 61 6c 6c |er. It w|ill call|
|00002490| 20 47 72 6f 77 55 54 61 | 62 6c 65 20 69 66 20 74 | GrowUTa|ble if t|
|000024a0| 68 65 72 65 20 69 73 0d | 20 2a 09 6e 6f 74 20 65 |here is.| *.not e|
|000024b0| 6e 6f 75 67 68 20 72 6f | 6f 6d 20 69 6e 20 74 68 |nough ro|om in th|
|000024c0| 65 20 63 75 72 72 65 6e | 74 20 75 6e 69 74 20 74 |e curren|t unit t|
|000024d0| 61 62 6c 65 2e 20 49 74 | 20 77 69 6c 6c 20 72 65 |able. It| will re|
|000024e0| 74 75 72 6e 20 74 68 65 | 20 66 69 72 73 74 0d 20 |turn the| first. |
|000024f0| 2a 09 61 76 61 69 6c 61 | 62 6c 65 20 73 6c 6f 74 |*.availa|ble slot|
|00002500| 20 62 65 74 77 65 65 6e | 20 4c 4f 57 5f 55 4e 49 | between| LOW_UNI|
|00002510| 54 20 61 6e 64 20 55 50 | 5f 55 4e 49 54 2e 20 52 |T and UP|_UNIT. R|
|00002520| 65 61 64 73 20 74 68 65 | 20 6c 6f 77 2d 6d 65 6d |eads the| low-mem|
|00002530| 6f 72 79 0d 20 2a 09 67 | 6c 6f 62 61 6c 20 55 54 |ory. *.g|lobal UT|
|00002540| 61 62 6c 65 42 61 73 65 | 20 61 6e 64 20 6d 61 79 |ableBase| and may|
|00002550| 20 63 68 61 6e 67 65 20 | 61 73 20 77 65 6c 6c 20 | change |as well |
|00002560| 61 73 20 72 65 61 64 20 | 74 68 65 20 6c 6f 77 2d |as read |the low-|
|00002570| 6d 65 6d 6f 72 79 20 67 | 6c 6f 62 61 6c 0d 20 2a |memory g|lobal. *|
|00002580| 09 55 6e 69 74 4e 74 72 | 79 43 6e 74 2e 0d 20 2a |.UnitNtr|yCnt.. *|
|00002590| 2f 0d 0d 4f 53 45 72 72 | 20 44 72 69 76 65 72 41 |/..OSErr| DriverA|
|000025a0| 76 61 69 6c 28 73 68 6f | 72 74 20 2a 75 6e 69 74 |vail(sho|rt *unit|
|000025b0| 4e 75 6d 29 0d 7b 0d 09 | 73 68 6f 72 74 20 75 6e |Num).{..|short un|
|000025c0| 69 74 49 6e 64 65 78 3b | 0d 09 53 69 7a 65 20 55 |itIndex;|..Size U|
|000025d0| 54 61 62 6c 65 53 69 7a | 65 3b 0d 09 4f 53 45 72 |TableSiz|e;..OSEr|
|000025e0| 72 20 65 72 72 43 6f 64 | 65 20 3d 20 6e 6f 45 72 |r errCod|e = noEr|
|000025f0| 72 3b 0d 0d 23 64 65 66 | 69 6e 65 20 4c 4f 57 5f |r;..#def|ine LOW_|
|00002600| 55 4e 49 54 09 09 34 38 | 09 09 2f 2a 20 46 69 72 |UNIT..48|../* Fir|
|00002610| 73 74 20 55 6e 69 74 20 | 54 61 62 6c 65 20 45 6e |st Unit |Table En|
|00002620| 74 72 79 20 74 6f 20 75 | 73 65 09 09 2a 2f 0d 23 |try to u|se..*/.#|
|00002630| 64 65 66 69 6e 65 20 4e | 45 57 5f 55 4e 49 54 09 |define N|EW_UNIT.|
|00002640| 09 36 34 09 09 2f 2a 20 | 53 69 7a 65 20 6f 66 20 |.64../* |Size of |
|00002650| 61 20 22 6e 6f 72 6d 61 | 6c 22 20 55 6e 69 74 20 |a "norma|l" Unit |
|00002660| 54 61 62 6c 65 09 09 2a | 2f 0d 23 64 65 66 69 6e |Table..*|/.#defin|
|00002670| 65 20 4d 41 58 5f 55 4e | 49 54 09 09 31 32 38 09 |e MAX_UN|IT..128.|
|00002680| 09 2f 2a 20 4d 61 78 69 | 6d 75 6d 20 73 69 7a 65 |./* Maxi|mum size|
|00002690| 20 6f 66 20 61 20 55 6e | 69 74 20 54 61 62 6c 65 | of a Un|it Table|
|000026a0| 09 09 09 2a 2f 0d 23 64 | 65 66 69 6e 65 20 55 50 |...*/.#d|efine UP|
|000026b0| 5f 55 4e 49 54 09 09 09 | 34 09 09 2f 2a 20 53 69 |_UNIT...|4../* Si|
|000026c0| 7a 65 20 74 6f 20 62 6f | 75 6e 63 65 20 75 70 20 |ze to bo|unce up |
|000026d0| 55 6e 69 74 20 54 61 62 | 6c 65 09 09 09 2a 2f 0d |Unit Tab|le...*/.|
|000026e0| 09 0d 09 2a 75 6e 69 74 | 4e 75 6d 20 3d 20 30 3b |...*unit|Num = 0;|
|000026f0| 0d 09 55 54 61 62 6c 65 | 53 69 7a 65 20 3d 20 47 |..UTable|Size = G|
|00002700| 65 74 50 74 72 53 69 7a | 65 28 28 50 74 72 29 55 |etPtrSiz|e((Ptr)U|
|00002710| 54 41 42 4c 45 42 41 53 | 45 29 20 2f 20 73 69 7a |TABLEBAS|E) / siz|
|00002720| 65 6f 66 28 44 43 74 6c | 48 61 6e 64 6c 65 29 3b |eof(DCtl|Handle);|
|00002730| 0d 09 0d 09 2f 2a 20 53 | 65 65 20 69 66 20 77 65 |..../* S|ee if we|
|00002740| 20 68 61 76 65 20 6c 65 | 73 73 20 74 68 61 6e 20 | have le|ss than |
|00002750| 74 68 65 20 6d 69 6e 69 | 6d 75 6d 20 6e 75 6d 62 |the mini|mum numb|
|00002760| 65 72 20 6f 66 20 75 6e | 69 74 20 65 6e 74 72 69 |er of un|it entri|
|00002770| 65 73 20 2a 2f 0d 09 69 | 66 28 55 4e 49 54 4e 54 |es */..i|f(UNITNT|
|00002780| 52 59 43 4e 54 20 3c 3d | 20 4c 4f 57 5f 55 4e 49 |RYCNT <=| LOW_UNI|
|00002790| 54 29 20 7b 0d 0d 09 09 | 2f 2a 20 54 72 79 20 74 |T) {....|/* Try t|
|000027a0| 6f 20 6d 61 6b 65 20 55 | 6e 69 74 20 54 61 62 6c |o make U|nit Tabl|
|000027b0| 65 20 74 68 65 20 73 74 | 61 6e 64 61 72 64 20 73 |e the st|andard s|
|000027c0| 69 7a 65 20 2a 2f 0d 09 | 09 69 66 28 55 54 61 62 |ize */..|.if(UTab|
|000027d0| 6c 65 53 69 7a 65 20 3c | 20 4e 45 57 5f 55 4e 49 |leSize <| NEW_UNI|
|000027e0| 54 29 0d 09 09 09 65 72 | 72 43 6f 64 65 20 3d 20 |T)....er|rCode = |
|000027f0| 47 72 6f 77 55 54 61 62 | 6c 65 28 4e 45 57 5f 55 |GrowUTab|le(NEW_U|
|00002800| 4e 49 54 20 2d 20 55 54 | 61 62 6c 65 53 69 7a 65 |NIT - UT|ableSize|
|00002810| 29 3b 0d 0d 09 09 2f 2a | 20 49 66 20 74 68 65 72 |);..../*| If ther|
|00002820| 65 20 69 73 20 61 6e 20 | 65 72 72 6f 72 2c 20 73 |e is an |error, s|
|00002830| 65 65 20 69 66 20 74 68 | 65 72 65 20 69 73 20 65 |ee if th|ere is e|
|00002840| 6e 6f 75 67 68 20 72 6f | 6f 6d 20 61 6e 79 77 61 |nough ro|om anywa|
|00002850| 79 20 2a 2f 0d 09 09 69 | 66 28 65 72 72 43 6f 64 |y */...i|f(errCod|
|00002860| 65 20 21 3d 20 6e 6f 45 | 72 72 29 20 7b 0d 09 09 |e != noE|rr) {...|
|00002870| 09 69 66 28 55 54 61 62 | 6c 65 53 69 7a 65 20 3e |.if(UTab|leSize >|
|00002880| 20 4c 4f 57 5f 55 4e 49 | 54 29 20 7b 0d 09 09 09 | LOW_UNI|T) {....|
|00002890| 09 55 4e 49 54 4e 54 52 | 59 43 4e 54 20 3d 20 28 |.UNITNTR|YCNT = (|
|000028a0| 55 4e 49 54 4e 54 52 59 | 43 4e 54 20 2b 20 34 20 |UNITNTRY|CNT + 4 |
|000028b0| 3c 20 55 54 61 62 6c 65 | 53 69 7a 65 20 3f 0d 09 |< UTable|Size ?..|
|000028c0| 09 09 09 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |... | |
|000028d0| 20 20 55 4e 49 54 4e 54 | 52 59 43 4e 54 20 2b 20 | UNITNT|RYCNT + |
|000028e0| 34 20 3a 0d 09 09 09 09 | 20 20 20 20 20 20 20 20 |4 :.....| |
|000028f0| 20 20 20 20 20 20 20 55 | 54 61 62 6c 65 53 69 7a | U|TableSiz|
|00002900| 65 29 3b 0d 09 09 09 09 | 65 72 72 43 6f 64 65 20 |e);.....|errCode |
|00002910| 3d 20 6e 6f 45 72 72 3b | 0d 09 09 09 7d 0d 09 09 |= noErr;|....}...|
|00002920| 7d 0d 09 09 69 66 28 65 | 72 72 43 6f 64 65 20 3d |}...if(e|rrCode =|
|00002930| 3d 20 6e 6f 45 72 72 29 | 0d 09 09 09 2a 75 6e 69 |= noErr)|....*uni|
|00002940| 74 4e 75 6d 20 3d 20 4c | 4f 57 5f 55 4e 49 54 3b |tNum = L|OW_UNIT;|
|00002950| 0d 09 09 72 65 74 75 72 | 6e 28 65 72 72 43 6f 64 |...retur|n(errCod|
|00002960| 65 29 3b 0d 09 7d 0d 09 | 0d 09 2f 2a 20 4c 6f 6f |e);..}..|../* Loo|
|00002970| 6b 20 66 6f 72 20 61 6e | 20 65 6d 70 74 79 20 73 |k for an| empty s|
|00002980| 6c 6f 74 20 69 6e 20 77 | 68 61 74 27 73 20 61 6c |lot in w|hat's al|
|00002990| 72 65 61 64 79 20 74 68 | 65 72 65 20 2a 2f 0d 09 |ready th|ere */..|
|000029a0| 66 6f 72 28 75 6e 69 74 | 49 6e 64 65 78 20 3d 20 |for(unit|Index = |
|000029b0| 4c 4f 57 5f 55 4e 49 54 | 3b 0d 09 20 20 20 20 28 |LOW_UNIT|;.. (|
|000029c0| 75 6e 69 74 49 6e 64 65 | 78 20 3c 20 55 4e 49 54 |unitInde|x < UNIT|
|000029d0| 4e 54 52 59 43 4e 54 29 | 20 26 26 20 28 2a 75 6e |NTRYCNT)| && (*un|
|000029e0| 69 74 4e 75 6d 20 3d 3d | 20 30 29 3b 0d 09 20 20 |itNum ==| 0);.. |
|000029f0| 20 20 2b 2b 75 6e 69 74 | 49 6e 64 65 78 29 0d 09 | ++unit|Index)..|
|00002a00| 09 69 66 28 55 54 41 42 | 4c 45 42 41 53 45 5b 75 |.if(UTAB|LEBASE[u|
|00002a10| 6e 69 74 49 6e 64 65 78 | 5d 20 3d 3d 20 6e 69 6c |nitIndex|] == nil|
|00002a20| 29 0d 09 09 09 2a 75 6e | 69 74 4e 75 6d 20 3d 20 |)....*un|itNum = |
|00002a30| 75 6e 69 74 49 6e 64 65 | 78 3b 0d 09 0d 09 2f 2a |unitInde|x;..../*|
|00002a40| 20 55 6e 69 74 20 54 61 | 62 6c 65 20 66 75 6c 6c | Unit Ta|ble full|
|00002a50| 20 75 70 20 74 6f 20 55 | 6e 69 74 4e 74 72 79 43 | up to U|nitNtryC|
|00002a60| 6e 74 2c 20 73 6f 20 69 | 6e 63 72 65 61 73 65 20 |nt, so i|ncrease |
|00002a70| 69 74 20 2a 2f 0d 09 69 | 66 28 2a 75 6e 69 74 4e |it */..i|f(*unitN|
|00002a80| 75 6d 20 3d 3d 20 30 29 | 20 7b 0d 0d 09 09 2f 2a |um == 0)| {..../*|
|00002a90| 20 49 66 20 74 68 65 72 | 65 20 69 73 20 73 70 61 | If ther|e is spa|
|00002aa0| 63 65 20 69 6e 20 74 68 | 65 20 55 6e 69 74 20 54 |ce in th|e Unit T|
|00002ab0| 61 62 6c 65 2c 20 6a 75 | 73 74 20 75 70 20 74 68 |able, ju|st up th|
|00002ac0| 65 20 63 6f 75 6e 74 20 | 2a 2f 0d 09 09 69 66 28 |e count |*/...if(|
|00002ad0| 55 54 61 62 6c 65 53 69 | 7a 65 20 3e 20 55 4e 49 |UTableSi|ze > UNI|
|00002ae0| 54 4e 54 52 59 43 4e 54 | 29 20 7b 0d 09 09 09 2a |TNTRYCNT|) {....*|
|00002af0| 75 6e 69 74 4e 75 6d 20 | 3d 20 55 4e 49 54 4e 54 |unitNum |= UNITNT|
|00002b00| 52 59 43 4e 54 3b 0d 09 | 09 09 55 4e 49 54 4e 54 |RYCNT;..|..UNITNT|
|00002b10| 52 59 43 4e 54 20 2b 3d | 20 28 55 54 61 62 6c 65 |RYCNT +=| (UTable|
|00002b20| 53 69 7a 65 20 2d 20 55 | 4e 49 54 4e 54 52 59 43 |Size - U|NITNTRYC|
|00002b30| 4e 54 20 3c 20 55 50 5f | 55 4e 49 54 20 3f 0d 09 |NT < UP_|UNIT ?..|
|00002b40| 09 09 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |.. | |
|00002b50| 20 20 55 54 61 62 6c 65 | 53 69 7a 65 20 2d 20 55 | UTable|Size - U|
|00002b60| 4e 49 54 4e 54 52 59 43 | 4e 54 20 3a 0d 09 09 09 |NITNTRYC|NT :....|
|00002b70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002b80| 55 50 5f 55 4e 49 54 29 | 3b 0d 09 09 0d 09 09 2f |UP_UNIT)|;....../|
|00002b90| 2a 20 49 66 20 74 68 65 | 72 65 20 69 73 6e 27 74 |* If the|re isn't|
|00002ba0| 20 65 6e 6f 75 67 68 20 | 73 70 61 63 65 2c 20 74 | enough |space, t|
|00002bb0| 72 79 20 74 6f 20 6d 61 | 6b 65 20 69 74 20 62 69 |ry to ma|ke it bi|
|00002bc0| 67 67 65 72 20 2a 2f 0d | 09 09 7d 20 65 6c 73 65 |gger */.|..} else|
|00002bd0| 20 7b 0d 09 09 09 69 66 | 28 4d 41 58 5f 55 4e 49 | {....if|(MAX_UNI|
|00002be0| 54 20 2d 20 55 4e 49 54 | 4e 54 52 59 43 4e 54 20 |T - UNIT|NTRYCNT |
|00002bf0| 21 3d 20 30 29 20 7b 0d | 09 09 09 09 75 6e 69 74 |!= 0) {.|....unit|
|00002c00| 49 6e 64 65 78 20 3d 20 | 55 4e 49 54 4e 54 52 59 |Index = |UNITNTRY|
|00002c10| 43 4e 54 3b 0d 09 09 09 | 09 65 72 72 43 6f 64 65 |CNT;....|.errCode|
|00002c20| 20 3d 20 47 72 6f 77 55 | 54 61 62 6c 65 28 4d 41 | = GrowU|Table(MA|
|00002c30| 58 5f 55 4e 49 54 20 2d | 20 55 4e 49 54 4e 54 52 |X_UNIT -| UNITNTR|
|00002c40| 59 43 4e 54 20 3c 20 55 | 50 5f 55 4e 49 54 20 3f |YCNT < U|P_UNIT ?|
|00002c50| 0d 09 09 09 09 20 20 20 | 20 20 20 20 20 20 20 20 |..... | |
|00002c60| 20 20 20 20 20 20 20 20 | 20 20 4d 41 58 5f 55 4e | | MAX_UN|
|00002c70| 49 54 20 2d 20 55 4e 49 | 54 4e 54 52 59 43 4e 54 |IT - UNI|TNTRYCNT|
|00002c80| 20 3a 0d 09 09 09 09 20 | 20 20 20 20 20 20 20 20 | :..... | |
|00002c90| 20 20 20 20 20 20 20 20 | 20 20 20 20 55 50 5f 55 | | UP_U|
|00002ca0| 4e 49 54 29 3b 0d 09 09 | 09 09 69 66 28 65 72 72 |NIT);...|..if(err|
|00002cb0| 43 6f 64 65 20 21 3d 20 | 6e 6f 45 72 72 29 0d 09 |Code != |noErr)..|
|00002cc0| 09 09 09 09 72 65 74 75 | 72 6e 28 65 72 72 43 6f |....retu|rn(errCo|
|00002cd0| 64 65 29 3b 0d 09 09 09 | 09 2a 75 6e 69 74 4e 75 |de);....|.*unitNu|
|00002ce0| 6d 20 3d 20 75 6e 69 74 | 49 6e 64 65 78 3b 0d 09 |m = unit|Index;..|
|00002cf0| 09 09 7d 0d 09 09 7d 0d | 09 7d 0d 09 69 66 28 2a |..}...}.|.}..if(*|
|00002d00| 75 6e 69 74 4e 75 6d 20 | 3d 3d 20 30 29 0d 09 09 |unitNum |== 0)...|
|00002d10| 72 65 74 75 72 6e 28 75 | 6e 69 74 54 62 6c 46 75 |return(u|nitTblFu|
|00002d20| 6c 6c 45 72 72 29 3b 0d | 09 65 6c 73 65 0d 09 09 |llErr);.|.else...|
|00002d30| 72 65 74 75 72 6e 28 6e | 6f 45 72 72 29 3b 0d 7d |return(n|oErr);.}|
|00002d40| 0d 0d 0d 2f 2a 0d 20 2a | 09 47 65 74 31 53 79 73 |.../*. *|.Get1Sys|
|00002d50| 58 52 73 72 63 20 67 65 | 74 73 20 61 20 68 61 6e |XRsrc ge|ts a han|
|00002d60| 64 6c 65 20 74 6f 20 74 | 68 65 20 72 65 71 75 65 |dle to t|he reque|
|00002d70| 73 74 65 64 20 72 65 73 | 6f 75 72 63 65 20 6d 61 |sted res|ource ma|
|00002d80| 6b 69 6e 67 20 73 75 72 | 65 20 74 68 61 74 0d 20 |king sur|e that. |
|00002d90| 2a 09 62 6f 74 68 20 74 | 68 65 20 72 65 73 6f 75 |*.both t|he resou|
|00002da0| 72 63 65 20 69 74 73 65 | 6c 66 20 61 6e 64 20 74 |rce itse|lf and t|
|00002db0| 68 65 20 6d 61 73 74 65 | 72 20 70 6f 69 6e 74 65 |he maste|r pointe|
|00002dc0| 72 20 61 72 65 20 69 6e | 20 74 68 65 20 73 79 73 |r are in| the sys|
|00002dd0| 74 65 6d 20 68 65 61 70 | 0d 20 2a 09 61 6e 64 20 |tem heap|. *.and |
|00002de0| 6e 6f 6e 2d 70 75 72 67 | 65 61 62 6c 65 2e 20 54 |non-purg|eable. T|
|00002df0| 68 65 20 72 65 73 6f 75 | 72 63 65 20 69 73 20 72 |he resou|rce is r|
|00002e00| 65 74 75 72 6e 65 64 20 | 69 6e 20 72 73 72 63 48 |eturned |in rsrcH|
|00002e10| 6e 64 6c 2e 20 54 68 65 | 20 72 65 73 6f 75 72 63 |ndl. The| resourc|
|00002e20| 65 0d 20 2a 09 77 69 6c | 6c 20 62 65 20 72 65 74 |e. *.wil|l be ret|
|00002e30| 72 69 65 76 65 64 20 61 | 63 63 6f 72 64 69 6e 67 |rieved a|ccording|
|00002e40| 20 74 6f 20 72 65 73 6f | 75 72 63 65 20 74 79 70 | to reso|urce typ|
|00002e50| 65 20 61 6e 64 20 65 69 | 74 68 65 72 20 72 65 73 |e and ei|ther res|
|00002e60| 6f 75 72 63 65 20 6e 61 | 6d 65 2c 0d 20 2a 09 6f |ource na|me,. *.o|
|00002e70| 72 20 72 65 73 6f 75 72 | 63 65 20 69 6e 64 65 78 |r resour|ce index|
|00002e80| 2c 20 6f 72 20 72 65 73 | 6f 75 72 63 65 20 49 44 |, or res|ource ID|
|00002e90| 2c 20 69 6e 20 74 68 61 | 74 20 6f 72 64 65 72 2c |, in tha|t order,|
|00002ea0| 20 77 68 69 63 68 65 76 | 65 72 20 69 73 0d 20 2a | whichev|er is. *|
|00002eb0| 09 6e 6f 6e 2d 7a 65 72 | 6f 2e 0d 20 2a 2f 0d 0d |.non-zer|o.. */..|
|00002ec0| 4f 53 45 72 72 20 47 65 | 74 31 53 79 73 58 52 73 |OSErr Ge|t1SysXRs|
|00002ed0| 72 63 28 48 61 6e 64 6c | 65 20 2a 72 73 72 63 48 |rc(Handl|e *rsrcH|
|00002ee0| 6e 64 6c 2c 20 52 65 73 | 54 79 70 65 20 72 73 72 |ndl, Res|Type rsr|
|00002ef0| 63 54 79 70 65 2c 20 73 | 68 6f 72 74 20 72 73 72 |cType, s|hort rsr|
|00002f00| 63 49 44 2c 0d 20 20 20 | 20 20 20 20 20 20 20 20 |cID,. | |
|00002f10| 20 20 20 20 20 20 20 20 | 73 68 6f 72 74 20 72 73 | |short rs|
|00002f20| 72 63 49 6e 64 2c 20 53 | 74 72 69 6e 67 50 74 72 |rcInd, S|tringPtr|
|00002f30| 20 72 73 72 63 4e 61 6d | 65 29 0d 7b 0d 09 54 48 | rsrcNam|e).{..TH|
|00002f40| 7a 20 74 65 6d 70 5a 6f | 6e 65 2c 20 74 65 6d 70 |z tempZo|ne, temp|
|00002f50| 53 79 73 5a 6f 6e 65 3b | 0d 09 4f 53 45 72 72 20 |SysZone;|..OSErr |
|00002f60| 65 72 72 43 6f 64 65 2c | 20 70 74 72 43 6f 64 65 |errCode,| ptrCode|
|00002f70| 20 3d 20 6e 6f 45 72 72 | 3b 0d 09 0d 09 2f 2a 20 | = noErr|;..../* |
|00002f80| 4d 61 6b 65 20 73 75 72 | 65 20 65 76 65 72 79 74 |Make sur|e everyt|
|00002f90| 68 69 6e 67 20 6c 6f 61 | 64 73 20 69 6e 20 74 68 |hing loa|ds in th|
|00002fa0| 65 20 73 79 73 74 65 6d | 20 68 65 61 70 20 2a 2f |e system| heap */|
|00002fb0| 0d 09 74 65 6d 70 5a 6f | 6e 65 20 3d 20 47 65 74 |..tempZo|ne = Get|
|00002fc0| 5a 6f 6e 65 28 29 3b 0d | 09 74 65 6d 70 53 79 73 |Zone();.|.tempSys|
|00002fd0| 5a 6f 6e 65 20 3d 20 53 | 79 73 74 65 6d 5a 6f 6e |Zone = S|ystemZon|
|00002fe0| 65 28 29 3b 0d 09 53 65 | 74 5a 6f 6e 65 28 74 65 |e();..Se|tZone(te|
|00002ff0| 6d 70 53 79 73 5a 6f 6e | 65 29 3b 0d 09 53 65 74 |mpSysZon|e);..Set|
|00003000| 52 65 73 4c 6f 61 64 28 | 74 72 75 65 29 3b 0d 09 |ResLoad(|true);..|
|00003010| 0d 09 2f 2a 20 47 65 74 | 20 74 68 65 20 72 65 73 |../* Get| the res|
|00003020| 6f 75 72 63 65 20 61 6e | 64 20 6d 61 6b 65 20 73 |ource an|d make s|
|00003030| 75 72 65 20 69 74 20 69 | 73 20 69 6e 20 74 68 65 |ure it i|s in the|
|00003040| 20 73 79 73 74 65 6d 20 | 68 65 61 70 20 2a 2f 0d | system |heap */.|
|00003050| 09 64 6f 20 7b 0d 09 09 | 65 72 72 43 6f 64 65 20 |.do {...|errCode |
|00003060| 3d 20 70 74 72 43 6f 64 | 65 3b 0d 09 09 69 66 28 |= ptrCod|e;...if(|
|00003070| 72 73 72 63 4e 61 6d 65 | 20 21 3d 20 6e 69 6c 29 |rsrcName| != nil)|
|00003080| 0d 09 09 09 2a 72 73 72 | 63 48 6e 64 6c 20 3d 20 |....*rsr|cHndl = |
|00003090| 47 65 74 31 4e 61 6d 65 | 64 52 65 73 6f 75 72 63 |Get1Name|dResourc|
|000030a0| 65 28 72 73 72 63 54 79 | 70 65 2c 20 72 73 72 63 |e(rsrcTy|pe, rsrc|
|000030b0| 4e 61 6d 65 29 3b 0d 09 | 09 65 6c 73 65 20 69 66 |Name);..|.else if|
|000030c0| 28 72 73 72 63 49 6e 64 | 20 21 3d 20 30 29 0d 09 |(rsrcInd| != 0)..|
|000030d0| 09 09 2a 72 73 72 63 48 | 6e 64 6c 20 3d 20 47 65 |..*rsrcH|ndl = Ge|
|000030e0| 74 31 49 6e 64 52 65 73 | 6f 75 72 63 65 28 72 73 |t1IndRes|ource(rs|
|000030f0| 72 63 54 79 70 65 2c 20 | 72 73 72 63 49 6e 64 29 |rcType, |rsrcInd)|
|00003100| 3b 0d 09 09 65 6c 73 65 | 0d 09 09 09 2a 72 73 72 |;...else|....*rsr|
|00003110| 63 48 6e 64 6c 20 3d 20 | 47 65 74 31 52 65 73 6f |cHndl = |Get1Reso|
|00003120| 75 72 63 65 28 72 73 72 | 63 54 79 70 65 2c 20 72 |urce(rsr|cType, r|
|00003130| 73 72 63 49 44 29 3b 0d | 09 09 69 66 28 2a 72 73 |srcID);.|..if(*rs|
|00003140| 72 63 48 6e 64 6c 20 21 | 3d 20 6e 69 6c 29 20 7b |rcHndl !|= nil) {|
|00003150| 0d 09 09 09 69 66 28 50 | 74 72 49 6e 5a 6f 6e 65 |....if(P|trInZone|
|00003160| 28 74 65 6d 70 53 79 73 | 5a 6f 6e 65 2c 20 28 50 |(tempSys|Zone, (P|
|00003170| 74 72 29 2a 72 73 72 63 | 48 6e 64 6c 29 20 26 26 |tr)*rsrc|Hndl) &&|
|00003180| 0d 09 09 09 20 20 20 50 | 74 72 49 6e 5a 6f 6e 65 |.... P|trInZone|
|00003190| 28 74 65 6d 70 53 79 73 | 5a 6f 6e 65 2c 20 28 50 |(tempSys|Zone, (P|
|000031a0| 74 72 29 2a 2a 72 73 72 | 63 48 6e 64 6c 29 29 20 |tr)**rsr|cHndl)) |
|000031b0| 7b 0d 09 09 09 09 48 4e | 6f 50 75 72 67 65 28 2a |{.....HN|oPurge(*|
|000031c0| 72 73 72 63 48 6e 64 6c | 29 3b 0d 09 09 09 09 65 |rsrcHndl|);.....e|
|000031d0| 72 72 43 6f 64 65 20 3d | 20 6e 6f 45 72 72 3b 0d |rrCode =| noErr;.|
|000031e0| 09 09 09 7d 20 65 6c 73 | 65 20 7b 0d 09 09 09 09 |...} els|e {.....|
|000031f0| 52 65 6c 65 61 73 65 52 | 65 73 6f 75 72 63 65 28 |ReleaseR|esource(|
|00003200| 2a 72 73 72 63 48 6e 64 | 6c 29 3b 0d 09 09 09 09 |*rsrcHnd|l);.....|
|00003210| 2a 72 73 72 63 48 6e 64 | 6c 20 3d 20 6e 69 6c 3b |*rsrcHnd|l = nil;|
|00003220| 0d 09 09 09 09 70 74 72 | 43 6f 64 65 20 3d 20 6d |.....ptr|Code = m|
|00003230| 65 6d 41 5a 45 72 72 3b | 0d 09 09 09 7d 0d 09 09 |emAZErr;|....}...|
|00003240| 7d 20 65 6c 73 65 20 7b | 0d 09 09 09 69 66 28 28 |} else {|....if((|
|00003250| 65 72 72 43 6f 64 65 20 | 3d 20 52 65 73 45 72 72 |errCode |= ResErr|
|00003260| 6f 72 28 29 29 20 3d 3d | 20 6e 6f 45 72 72 29 0d |or()) ==| noErr).|
|00003270| 09 09 09 09 65 72 72 43 | 6f 64 65 20 3d 20 72 65 |....errC|ode = re|
|00003280| 73 4e 6f 74 46 6f 75 6e | 64 3b 0d 09 09 7d 0d 09 |sNotFoun|d;...}..|
|00003290| 7d 20 77 68 69 6c 65 28 | 65 72 72 43 6f 64 65 20 |} while(|errCode |
|000032a0| 3d 3d 20 6e 6f 45 72 72 | 20 26 26 20 2a 72 73 72 |== noErr| && *rsr|
|000032b0| 63 48 6e 64 6c 20 3d 3d | 20 6e 69 6c 29 3b 0d 09 |cHndl ==| nil);..|
|000032c0| 0d 09 2f 2a 20 52 65 73 | 74 6f 72 65 20 74 68 65 |../* Res|tore the|
|000032d0| 20 7a 6f 6e 65 20 74 6f | 20 77 68 61 74 20 69 74 | zone to| what it|
|000032e0| 20 77 61 73 20 2a 2f 0d | 09 53 65 74 5a 6f 6e 65 | was */.|.SetZone|
|000032f0| 28 74 65 6d 70 5a 6f 6e | 65 29 3b 0d 09 72 65 74 |(tempZon|e);..ret|
|00003300| 75 72 6e 28 65 72 72 43 | 6f 64 65 29 3b 0d 7d 0d |urn(errC|ode);.}.|
|00003310| 0d 2f 2a 0d 20 2a 09 50 | 74 72 49 6e 5a 6f 6e 65 |./*. *.P|trInZone|
|00003320| 20 6a 75 73 74 20 63 68 | 65 63 6b 73 20 74 6f 20 | just ch|ecks to |
|00003330| 73 65 65 20 77 68 65 74 | 68 65 72 20 74 68 65 20 |see whet|her the |
|00003340| 73 70 65 63 69 66 69 65 | 64 20 70 6f 69 6e 74 65 |specifie|d pointe|
|00003350| 72 20 69 73 20 77 69 74 | 68 69 6e 0d 20 2a 09 74 |r is wit|hin. *.t|
|00003360| 68 65 20 73 70 65 63 69 | 66 69 65 64 20 7a 6f 6e |he speci|fied zon|
|00003370| 65 2e 0d 20 2a 2f 0d 0d | 42 6f 6f 6c 65 61 6e 20 |e.. */..|Boolean |
|00003380| 50 74 72 49 6e 5a 6f 6e | 65 28 54 48 7a 20 74 68 |PtrInZon|e(THz th|
|00003390| 65 5a 6f 6e 65 2c 20 50 | 74 72 20 74 68 65 50 74 |eZone, P|tr thePt|
|000033a0| 72 29 0d 7b 0d 09 72 65 | 67 69 73 74 65 72 20 75 |r).{..re|gister u|
|000033b0| 6e 73 69 67 6e 65 64 20 | 6c 6f 6e 67 20 73 74 72 |nsigned |long str|
|000033c0| 69 70 4d 61 73 6b 2c 20 | 74 65 73 74 50 74 72 2c |ipMask, |testPtr,|
|000033d0| 20 64 61 74 61 53 74 61 | 72 74 2c 20 64 61 74 61 | dataSta|rt, data|
|000033e0| 4c 69 6d 3b 0d 09 0d 09 | 73 74 72 69 70 4d 61 73 |Lim;....|stripMas|
|000033f0| 6b 20 3d 20 28 75 6e 73 | 69 67 6e 65 64 20 6c 6f |k = (uns|igned lo|
|00003400| 6e 67 29 53 74 72 69 70 | 41 64 64 72 65 73 73 28 |ng)Strip|Address(|
|00003410| 28 76 6f 69 64 20 2a 29 | 30 78 46 46 46 46 46 46 |(void *)|0xFFFFFF|
|00003420| 46 46 29 3b 0d 09 64 61 | 74 61 53 74 61 72 74 20 |FF);..da|taStart |
|00003430| 3d 20 28 75 6e 73 69 67 | 6e 65 64 20 6c 6f 6e 67 |= (unsig|ned long|
|00003440| 29 26 74 68 65 5a 6f 6e | 65 2d 3e 68 65 61 70 44 |)&theZon|e->heapD|
|00003450| 61 74 61 20 26 20 73 74 | 72 69 70 4d 61 73 6b 3b |ata & st|ripMask;|
|00003460| 0d 09 64 61 74 61 4c 69 | 6d 20 3d 20 28 75 6e 73 |..dataLi|m = (uns|
|00003470| 69 67 6e 65 64 20 6c 6f | 6e 67 29 74 68 65 5a 6f |igned lo|ng)theZo|
|00003480| 6e 65 2d 3e 62 6b 4c 69 | 6d 20 26 20 73 74 72 69 |ne->bkLi|m & stri|
|00003490| 70 4d 61 73 6b 3b 0d 09 | 74 65 73 74 50 74 72 20 |pMask;..|testPtr |
|000034a0| 3d 20 28 75 6e 73 69 67 | 6e 65 64 20 6c 6f 6e 67 |= (unsig|ned long|
|000034b0| 29 74 68 65 50 74 72 20 | 26 20 73 74 72 69 70 4d |)thePtr |& stripM|
|000034c0| 61 73 6b 3b 0d 09 72 65 | 74 75 72 6e 28 28 74 65 |ask;..re|turn((te|
|000034d0| 73 74 50 74 72 20 3c 20 | 64 61 74 61 4c 69 6d 29 |stPtr < |dataLim)|
|000034e0| 20 26 26 20 28 74 65 73 | 74 50 74 72 20 3e 3d 20 | && (tes|tPtr >= |
|000034f0| 64 61 74 61 53 74 61 72 | 74 29 29 3b 0d 7d 0d 0d |dataStar|t));.}..|
|00003500| 2f 2a 0d 20 2a 09 54 48 | 49 4e 4b 20 43 20 75 73 |/*. *.TH|INK C us|
|00003510| 65 73 20 61 20 44 41 54 | 41 20 72 65 73 6f 75 72 |es a DAT|A resour|
|00003520| 63 65 20 66 6f 72 20 73 | 74 6f 72 61 67 65 20 61 |ce for s|torage a|
|00003530| 6e 64 20 44 43 4f 44 20 | 72 65 73 6f 75 72 63 65 |nd DCOD |resource|
|00003540| 73 20 66 6f 72 0d 20 2a | 09 6d 75 6c 74 69 70 6c |s for. *|.multipl|
|00003550| 65 20 73 65 67 6d 65 6e | 74 73 20 69 6e 20 64 65 |e segmen|ts in de|
|00003560| 76 69 63 65 20 64 72 69 | 76 65 72 73 2e 20 54 48 |vice dri|vers. TH|
|00003570| 49 4e 4b 20 43 20 6d 61 | 6b 65 73 20 74 77 6f 20 |INK C ma|kes two |
|00003580| 70 72 65 74 74 79 20 62 | 61 64 0d 20 2a 09 61 73 |pretty b|ad. *.as|
|00003590| 73 75 6d 70 74 69 6f 6e | 73 20 61 62 6f 75 74 20 |sumption|s about |
|000035a0| 74 68 65 73 65 20 72 65 | 73 6f 75 72 63 65 73 3a |these re|sources:|
|000035b0| 20 28 61 29 20 74 68 61 | 74 20 74 68 65 20 72 65 | (a) tha|t the re|
|000035c0| 73 6f 75 72 63 65 20 66 | 69 6c 65 20 77 69 6c 6c |source f|ile will|
|000035d0| 0d 20 2a 09 62 65 20 6f | 70 65 6e 20 77 68 65 6e |. *.be o|pen when|
|000035e0| 20 74 68 65 20 72 65 73 | 6f 75 72 63 65 73 20 61 | the res|ources a|
|000035f0| 72 65 20 6e 65 65 64 65 | 64 3b 20 61 6e 64 20 28 |re neede|d; and (|
|00003600| 62 29 20 74 68 61 74 20 | 74 68 65 20 72 65 73 6f |b) that |the reso|
|00003610| 75 72 63 65 73 0d 20 2a | 09 77 69 6c 6c 20 62 65 |urces. *|.will be|
|00003620| 20 22 6f 77 6e 65 64 22 | 20 62 79 20 74 68 65 20 | "owned"| by the |
|00003630| 64 72 69 76 65 72 2e 20 | 52 65 73 6f 75 72 63 65 |driver. |Resource|
|00003640| 20 6f 77 6e 65 72 73 68 | 69 70 20 69 73 20 64 65 | ownersh|ip is de|
|00003650| 73 63 72 69 62 65 64 20 | 69 6e 0d 20 2a 09 49 6e |scribed |in. *.In|
|00003660| 73 69 64 65 20 4d 61 63 | 69 6e 74 6f 73 68 20 49 |side Mac|intosh I|
|00003670| 2c 20 62 75 74 20 74 68 | 65 20 69 6d 70 6f 72 74 |, but th|e import|
|00003680| 61 6e 74 20 70 6f 69 6e | 74 20 69 73 20 74 68 61 |ant poin|t is tha|
|00003690| 74 20 74 68 65 20 64 72 | 69 76 65 72 20 61 73 73 |t the dr|iver ass|
|000036a0| 75 6d 65 73 0d 20 2a 09 | 74 68 61 74 20 69 74 73 |umes. *.|that its|
|000036b0| 20 75 6e 69 74 20 74 61 | 62 6c 65 20 6e 75 6d 62 | unit ta|ble numb|
|000036c0| 65 72 20 77 69 6c 6c 20 | 63 6f 72 72 65 73 70 6f |er will |correspo|
|000036d0| 6e 64 20 74 6f 20 69 74 | 73 20 6f 77 6e 20 72 65 |nd to it|s own re|
|000036e0| 73 6f 75 72 63 65 20 49 | 44 20 61 6e 64 0d 20 2a |source I|D and. *|
|000036f0| 09 74 6f 20 74 68 65 20 | 72 65 73 6f 75 72 63 65 |.to the |resource|
|00003700| 20 49 44 27 73 20 6f 66 | 20 72 65 73 6f 75 72 63 | ID's of| resourc|
|00003710| 65 73 20 69 74 20 6f 77 | 6e 73 2e 20 53 69 6e 63 |es it ow|ns. Sinc|
|00003720| 65 20 74 68 65 20 64 72 | 69 76 65 72 20 69 73 20 |e the dr|iver is |
|00003730| 67 6f 69 6e 67 0d 20 2a | 09 74 6f 20 62 65 20 69 |going. *|.to be i|
|00003740| 6e 73 74 61 6c 6c 65 64 | 20 69 6e 20 74 68 65 20 |nstalled| in the |
|00003750| 66 69 72 73 74 20 66 72 | 65 65 20 75 6e 69 74 20 |first fr|ee unit |
|00003760| 74 61 62 6c 65 20 65 6e | 74 72 79 20 61 6e 64 20 |table en|try and |
|00003770| 77 69 6c 6c 20 62 65 20 | 64 65 74 61 63 68 65 64 |will be |detached|
|00003780| 0d 20 2a 09 69 6e 20 74 | 68 65 20 73 79 73 74 65 |. *.in t|he syste|
|00003790| 6d 20 68 65 61 70 2c 20 | 62 6f 74 68 20 6f 66 20 |m heap, |both of |
|000037a0| 74 68 65 73 65 20 61 73 | 73 75 6d 70 74 69 6f 6e |these as|sumption|
|000037b0| 73 20 61 72 65 20 62 61 | 64 2e 20 54 6f 20 63 6f |s are ba|d. To co|
|000037c0| 72 72 65 63 74 0d 20 2a | 09 74 68 65 73 65 20 70 |rrect. *|.these p|
|000037d0| 72 6f 62 6c 65 6d 73 2c | 20 74 68 65 20 54 48 49 |roblems,| the THI|
|000037e0| 4e 4b 20 43 20 64 72 69 | 76 65 72 20 67 6c 75 65 |NK C dri|ver glue|
|000037f0| 20 69 73 20 70 61 74 63 | 68 65 64 2e 20 41 20 70 | is patc|hed. A p|
|00003800| 6f 69 6e 74 65 72 20 74 | 6f 20 61 0d 20 2a 09 73 |ointer t|o a. *.s|
|00003810| 6d 61 6c 6c 20 62 6c 6f | 63 6b 20 6f 66 20 63 6f |mall blo|ck of co|
|00003820| 64 65 20 69 73 20 6c 6f | 61 64 65 64 20 69 6e 74 |de is lo|aded int|
|00003830| 6f 20 74 68 65 20 73 79 | 73 74 65 6d 20 68 65 61 |o the sy|stem hea|
|00003840| 70 2e 20 4f 63 63 75 72 | 61 6e 63 65 73 20 6f 66 |p. Occur|ances of|
|00003850| 0d 20 2a 09 47 65 74 52 | 65 73 6f 75 72 63 65 20 |. *.GetR|esource |
|00003860| 63 61 6c 6c 73 20 69 6e | 20 74 68 65 20 54 48 49 |calls in| the THI|
|00003870| 4e 4b 20 43 20 64 72 69 | 76 65 72 20 67 6c 75 65 |NK C dri|ver glue|
|00003880| 20 61 72 65 20 72 65 70 | 6c 61 63 65 64 20 62 79 | are rep|laced by|
|00003890| 20 63 61 6c 6c 73 20 74 | 6f 0d 20 2a 09 74 68 65 | calls t|o. *.the|
|000038a0| 20 6e 65 77 20 72 6f 75 | 74 69 6e 65 2e 20 54 68 | new rou|tine. Th|
|000038b0| 65 20 68 61 6e 64 6c 65 | 73 20 74 6f 20 74 68 65 |e handle|s to the|
|000038c0| 20 44 41 54 41 20 28 61 | 6e 64 20 44 43 4f 44 29 | DATA (a|nd DCOD)|
|000038d0| 20 72 65 73 6f 75 72 63 | 65 28 73 29 20 61 72 65 | resourc|e(s) are|
|000038e0| 0d 20 2a 09 73 74 6f 72 | 65 64 20 61 6c 6f 6e 67 |. *.stor|ed along|
|000038f0| 20 77 69 74 68 20 74 68 | 65 20 72 6f 75 74 69 6e | with th|e routin|
|00003900| 65 2e 20 53 6f 2c 20 77 | 68 65 6e 20 54 48 49 4e |e. So, w|hen THIN|
|00003910| 4b 20 43 20 67 6f 65 73 | 20 6c 6f 6f 6b 69 6e 67 |K C goes| looking|
|00003920| 20 66 6f 72 20 69 74 73 | 0d 20 2a 09 6f 77 6e 65 | for its|. *.owne|
|00003930| 64 20 72 65 73 6f 75 72 | 63 65 28 73 29 2c 20 74 |d resour|ce(s), t|
|00003940| 68 65 20 61 70 70 72 6f | 70 72 69 61 74 65 20 68 |he appro|priate h|
|00003950| 61 6e 64 6c 65 28 73 29 | 20 61 72 65 20 72 65 74 |andle(s)| are ret|
|00003960| 75 72 6e 65 64 20 69 6e | 73 74 65 61 64 2e 0d 20 |urned in|stead.. |
|00003970| 2a 0d 20 2a 09 54 68 69 | 6e 6b 49 6e 69 74 20 67 |*. *.Thi|nkInit g|
|00003980| 65 74 73 20 61 6c 6c 20 | 6f 66 20 74 68 65 20 72 |ets all |of the r|
|00003990| 65 73 6f 75 72 63 65 73 | 20 6e 65 65 64 65 64 20 |esources| needed |
|000039a0| 61 6e 64 20 69 6e 73 74 | 61 6c 6c 73 20 74 68 65 |and inst|alls the|
|000039b0| 20 70 61 74 63 68 20 74 | 6f 0d 20 2a 09 74 68 65 | patch t|o. *.the|
|000039c0| 20 54 48 49 4e 4b 20 43 | 20 67 6c 75 65 2e 20 49 | THINK C| glue. I|
|000039d0| 74 20 74 61 6b 65 73 20 | 61 73 20 70 61 72 61 6d |t takes |as param|
|000039e0| 65 74 65 72 73 20 74 68 | 65 20 68 61 6e 64 6c 65 |eters th|e handle|
|000039f0| 20 74 6f 20 74 68 65 20 | 64 72 69 76 65 72 20 74 | to the |driver t|
|00003a00| 68 61 74 0d 20 2a 09 69 | 73 20 74 6f 20 62 65 20 |hat. *.i|s to be |
|00003a10| 70 61 74 63 68 65 64 2c | 20 74 68 65 20 6f 72 69 |patched,| the ori|
|00003a20| 67 69 6e 61 6c 20 72 65 | 73 6f 75 72 63 65 20 49 |ginal re|source I|
|00003a30| 44 20 6f 66 20 74 68 65 | 20 64 72 69 76 65 72 20 |D of the| driver |
|00003a40| 28 74 6f 20 66 69 67 75 | 72 65 20 6f 75 74 0d 20 |(to figu|re out. |
|00003a50| 2a 09 74 68 65 20 72 65 | 73 6f 75 72 63 65 20 49 |*.the re|source I|
|00003a60| 44 27 73 20 6f 66 20 74 | 68 65 20 44 41 54 41 20 |D's of t|he DATA |
|00003a70| 61 6e 64 20 44 43 4f 44 | 20 72 65 73 6f 75 72 63 |and DCOD| resourc|
|00003a80| 65 73 29 2c 20 74 68 65 | 20 63 75 72 72 65 6e 74 |es), the| current|
|00003a90| 20 75 6e 69 74 0d 20 2a | 09 74 61 62 6c 65 20 6e | unit. *|.table n|
|00003aa0| 75 6d 62 65 72 2c 20 61 | 6e 64 20 74 68 65 20 64 |umber, a|nd the d|
|00003ab0| 72 76 72 49 6e 73 74 46 | 6c 61 67 73 2e 0d 20 2a |rvrInstF|lags.. *|
|00003ac0| 2f 0d 0d 4f 53 45 72 72 | 20 54 68 69 6e 6b 49 6e |/..OSErr| ThinkIn|
|00003ad0| 69 74 28 48 61 6e 64 6c | 65 20 64 72 76 72 48 61 |it(Handl|e drvrHa|
|00003ae0| 6e 64 6c 65 2c 20 73 68 | 6f 72 74 20 72 73 72 63 |ndle, sh|ort rsrc|
|00003af0| 49 44 2c 20 73 68 6f 72 | 74 20 75 6e 69 74 4e 75 |ID, shor|t unitNu|
|00003b00| 6d 2c 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |m,. | |
|00003b10| 20 20 20 64 72 76 72 46 | 6c 61 67 42 69 74 73 20 | drvrF|lagBits |
|00003b20| 64 72 76 72 49 6e 73 74 | 46 6c 61 67 73 29 0d 7b |drvrInst|Flags).{|
|00003b30| 0d 09 48 61 6e 64 6c 65 | 20 63 6f 64 65 48 61 6e |..Handle| codeHan|
|00003b40| 64 6c 65 20 3d 20 6e 69 | 6c 3b 0d 09 50 74 72 20 |dle = ni|l;..Ptr |
|00003b50| 63 6f 64 65 50 74 72 3b | 0d 09 53 69 7a 65 20 63 |codePtr;|..Size c|
|00003b60| 6f 64 65 53 69 7a 65 3b | 0d 09 4f 53 45 72 72 20 |odeSize;|..OSErr |
|00003b70| 65 72 72 43 6f 64 65 3b | 0d 09 0d 09 2f 2a 20 47 |errCode;|..../* G|
|00003b80| 65 74 20 74 68 65 20 6e | 65 77 20 70 72 6f 63 65 |et the n|ew proce|
|00003b90| 64 75 72 65 20 63 6f 64 | 65 20 2a 2f 0d 09 63 6f |dure cod|e */..co|
|00003ba0| 64 65 48 61 6e 64 6c 65 | 20 3d 20 47 65 74 31 52 |deHandle| = Get1R|
|00003bb0| 65 73 6f 75 72 63 65 28 | 27 50 52 4f 43 27 2c 20 |esource(|'PROC', |
|00003bc0| 54 48 49 4e 4b 5f 50 52 | 4f 43 29 3b 0d 09 69 66 |THINK_PR|OC);..if|
|00003bd0| 28 63 6f 64 65 48 61 6e | 64 6c 65 20 3d 3d 20 6e |(codeHan|dle == n|
|00003be0| 69 6c 29 20 7b 0d 09 09 | 69 66 28 28 65 72 72 43 |il) {...|if((errC|
|00003bf0| 6f 64 65 20 3d 20 52 65 | 73 45 72 72 6f 72 28 29 |ode = Re|sError()|
|00003c00| 29 20 3d 3d 20 6e 6f 45 | 72 72 29 0d 09 09 09 65 |) == noE|rr)....e|
|00003c10| 72 72 43 6f 64 65 20 3d | 20 72 65 73 4e 6f 74 46 |rrCode =| resNotF|
|00003c20| 6f 75 6e 64 3b 0d 09 09 | 72 65 74 75 72 6e 28 65 |ound;...|return(e|
|00003c30| 72 72 43 6f 64 65 29 3b | 0d 09 7d 0d 0d 09 2f 2a |rrCode);|..}.../*|
|00003c40| 20 41 64 64 20 74 68 65 | 20 44 41 54 41 20 72 65 | Add the| DATA re|
|00003c50| 73 6f 75 72 63 65 20 74 | 6f 20 74 68 65 20 65 6e |source t|o the en|
|00003c60| 64 20 6f 66 20 74 68 65 | 20 63 6f 64 65 20 68 61 |d of the| code ha|
|00003c70| 6e 64 6c 65 20 2a 2f 0d | 09 65 72 72 43 6f 64 65 |ndle */.|.errCode|
|00003c80| 20 3d 20 54 68 69 6e 6b | 41 64 64 52 73 72 63 73 | = Think|AddRsrcs|
|00003c90| 28 63 6f 64 65 48 61 6e | 64 6c 65 2c 20 27 44 41 |(codeHan|dle, 'DA|
|00003ca0| 54 41 27 2c 20 72 73 72 | 63 49 44 2c 20 75 6e 69 |TA', rsr|cID, uni|
|00003cb0| 74 4e 75 6d 29 3b 0d 0d | 09 69 66 28 65 72 72 43 |tNum);..|.if(errC|
|00003cc0| 6f 64 65 20 3d 3d 20 6e | 6f 45 72 72 29 20 7b 0d |ode == n|oErr) {.|
|00003cd0| 09 09 2f 2a 20 41 64 64 | 20 74 68 65 20 44 43 4f |../* Add| the DCO|
|00003ce0| 44 20 72 65 73 6f 75 72 | 63 65 73 20 69 66 20 74 |D resour|ces if t|
|00003cf0| 68 69 73 20 69 73 20 61 | 20 6d 75 6c 74 69 2d 73 |his is a| multi-s|
|00003d00| 65 67 6d 65 6e 74 20 64 | 72 69 76 65 72 20 2a 2f |egment d|river */|
|00003d10| 0d 09 09 69 66 28 64 72 | 76 72 49 6e 73 74 46 6c |...if(dr|vrInstFl|
|00003d20| 61 67 73 20 26 20 74 68 | 69 6e 6b 4d 75 6c 53 65 |ags & th|inkMulSe|
|00003d30| 67 29 0d 09 09 09 65 72 | 72 43 6f 64 65 20 3d 20 |g)....er|rCode = |
|00003d40| 54 68 69 6e 6b 41 64 64 | 52 73 72 63 73 28 63 6f |ThinkAdd|Rsrcs(co|
|00003d50| 64 65 48 61 6e 64 6c 65 | 2c 20 27 44 43 4f 44 27 |deHandle|, 'DCOD'|
|00003d60| 2c 20 72 73 72 63 49 44 | 2c 20 75 6e 69 74 4e 75 |, rsrcID|, unitNu|
|00003d70| 6d 29 3b 0d 09 09 0d 09 | 09 69 66 28 65 72 72 43 |m);.....|.if(errC|
|00003d80| 6f 64 65 20 3d 3d 20 6e | 6f 45 72 72 29 20 7b 0d |ode == n|oErr) {.|
|00003d90| 09 09 0d 09 09 09 2f 2a | 20 43 72 65 61 74 65 20 |....../*| Create |
|00003da0| 61 20 70 6f 69 6e 74 65 | 72 20 69 6e 20 74 68 65 |a pointe|r in the|
|00003db0| 20 73 79 73 74 65 6d 20 | 68 65 61 70 20 74 6f 20 | system |heap to |
|00003dc0| 68 6f 6c 64 20 74 68 65 | 20 63 6f 64 65 20 2a 2f |hold the| code */|
|00003dd0| 0d 09 09 09 63 6f 64 65 | 53 69 7a 65 20 3d 20 47 |....code|Size = G|
|00003de0| 65 74 48 61 6e 64 6c 65 | 53 69 7a 65 28 63 6f 64 |etHandle|Size(cod|
|00003df0| 65 48 61 6e 64 6c 65 29 | 3b 0d 09 09 09 63 6f 64 |eHandle)|;....cod|
|00003e00| 65 50 74 72 20 3d 20 4e | 65 77 50 74 72 53 79 73 |ePtr = N|ewPtrSys|
|00003e10| 28 63 6f 64 65 53 69 7a | 65 29 3b 0d 09 09 09 69 |(codeSiz|e);....i|
|00003e20| 66 28 63 6f 64 65 50 74 | 72 20 3d 3d 20 6e 69 6c |f(codePt|r == nil|
|00003e30| 29 0d 09 09 09 09 65 72 | 72 43 6f 64 65 20 3d 20 |).....er|rCode = |
|00003e40| 6d 65 6d 46 75 6c 6c 45 | 72 72 3b 0d 09 09 09 65 |memFullE|rr;....e|
|00003e50| 6c 73 65 0d 09 09 09 09 | 42 6c 6f 63 6b 4d 6f 76 |lse.....|BlockMov|
|00003e60| 65 28 2a 63 6f 64 65 48 | 61 6e 64 6c 65 2c 20 63 |e(*codeH|andle, c|
|00003e70| 6f 64 65 50 74 72 2c 20 | 63 6f 64 65 53 69 7a 65 |odePtr, |codeSize|
|00003e80| 29 3b 0d 09 09 7d 0d 0d | 09 09 2f 2a 20 43 6c 65 |);...}..|../* Cle|
|00003e90| 61 6e 75 70 20 6f 6e 20 | 65 72 72 6f 72 73 20 2a |anup on |errors *|
|00003ea0| 2f 0d 09 09 69 66 28 65 | 72 72 43 6f 64 65 20 21 |/...if(e|rrCode !|
|00003eb0| 3d 20 6e 6f 45 72 72 29 | 20 7b 0d 09 09 09 48 4c |= noErr)| {....HL|
|00003ec0| 6f 63 6b 28 63 6f 64 65 | 48 61 6e 64 6c 65 29 3b |ock(code|Handle);|
|00003ed0| 0d 09 09 09 54 68 69 6e | 6b 52 6d 76 52 73 72 63 |....Thin|kRmvRsrc|
|00003ee0| 73 28 2a 63 6f 64 65 48 | 61 6e 64 6c 65 2c 20 74 |s(*codeH|andle, t|
|00003ef0| 72 75 65 2c 20 74 72 75 | 65 29 3b 0d 09 09 7d 0d |rue, tru|e);...}.|
|00003f00| 09 7d 0d 09 0d 09 2f 2a | 20 47 65 74 20 72 69 64 |.}..../*| Get rid|
|00003f10| 20 6f 66 20 74 68 65 20 | 63 6f 64 65 20 72 65 73 | of the |code res|
|00003f20| 6f 75 72 63 65 20 2a 2f | 0d 09 52 65 6c 65 61 73 |ource */|..Releas|
|00003f30| 65 52 65 73 6f 75 72 63 | 65 28 63 6f 64 65 48 61 |eResourc|e(codeHa|
|00003f40| 6e 64 6c 65 29 3b 0d 0d | 09 69 66 28 65 72 72 43 |ndle);..|.if(errC|
|00003f50| 6f 64 65 20 21 3d 20 6e | 6f 45 72 72 29 0d 09 09 |ode != n|oErr)...|
|00003f60| 72 65 74 75 72 6e 28 65 | 72 72 43 6f 64 65 29 3b |return(e|rrCode);|
|00003f70| 0d 09 0d 09 2f 2a 20 50 | 61 74 63 68 20 74 68 65 |..../* P|atch the|
|00003f80| 20 64 72 69 76 65 72 20 | 63 6f 64 65 20 66 6f 72 | driver |code for|
|00003f90| 20 74 68 65 20 44 41 54 | 41 20 72 65 73 6f 75 72 | the DAT|A resour|
|00003fa0| 63 65 2e 20 2a 2f 0d 09 | 65 72 72 43 6f 64 65 20 |ce. */..|errCode |
|00003fb0| 3d 20 54 68 69 6e 6b 43 | 68 61 6e 67 65 43 6f 64 |= ThinkC|hangeCod|
|00003fc0| 65 28 64 72 76 72 48 61 | 6e 64 6c 65 2c 20 63 6f |e(drvrHa|ndle, co|
|00003fd0| 64 65 50 74 72 2c 20 27 | 44 41 54 41 27 29 3b 0d |dePtr, '|DATA');.|
|00003fe0| 09 0d 09 2f 2a 20 49 66 | 20 74 68 65 72 65 20 61 |.../* If| there a|
|00003ff0| 72 65 20 6d 75 6c 74 69 | 70 6c 65 20 73 65 67 6d |re multi|ple segm|
|00004000| 65 6e 74 73 2c 20 74 61 | 6b 65 20 63 61 72 65 20 |ents, ta|ke care |
|00004010| 6f 66 20 74 68 65 6d 20 | 2a 2f 0d 09 69 66 28 28 |of them |*/..if((|
|00004020| 65 72 72 43 6f 64 65 20 | 3d 3d 20 6e 6f 45 72 72 |errCode |== noErr|
|00004030| 29 20 26 26 20 28 64 72 | 76 72 49 6e 73 74 46 6c |) && (dr|vrInstFl|
|00004040| 61 67 73 20 26 20 74 68 | 69 6e 6b 4d 75 6c 53 65 |ags & th|inkMulSe|
|00004050| 67 29 29 0d 09 09 65 72 | 72 43 6f 64 65 20 3d 20 |g))...er|rCode = |
|00004060| 54 68 69 6e 6b 43 68 61 | 6e 67 65 43 6f 64 65 28 |ThinkCha|ngeCode(|
|00004070| 64 72 76 72 48 61 6e 64 | 6c 65 2c 20 63 6f 64 65 |drvrHand|le, code|
|00004080| 50 74 72 2c 20 27 44 43 | 4f 44 27 29 3b 0d 0d 09 |Ptr, 'DC|OD');...|
|00004090| 2f 2a 20 43 6c 65 61 6e | 75 70 20 6f 6e 20 65 72 |/* Clean|up on er|
|000040a0| 72 6f 72 73 20 2a 2f 0d | 09 69 66 28 65 72 72 43 |rors */.|.if(errC|
|000040b0| 6f 64 65 20 21 3d 20 6e | 6f 45 72 72 29 0d 09 09 |ode != n|oErr)...|
|000040c0| 54 68 69 6e 6b 52 6d 76 | 52 73 72 63 73 28 63 6f |ThinkRmv|Rsrcs(co|
|000040d0| 64 65 50 74 72 2c 20 66 | 61 6c 73 65 2c 20 74 72 |dePtr, f|alse, tr|
|000040e0| 75 65 29 3b 0d 09 0d 09 | 72 65 74 75 72 6e 28 65 |ue);....|return(e|
|000040f0| 72 72 43 6f 64 65 29 3b | 0d 7d 0d 0d 2f 2a 0d 20 |rrCode);|.}../*. |
|00004100| 2a 09 54 68 69 6e 6b 43 | 68 61 6e 67 65 43 6f 64 |*.ThinkC|hangeCod|
|00004110| 65 20 63 68 61 6e 67 65 | 73 20 74 68 65 20 70 69 |e change|s the pi|
|00004120| 65 63 65 20 6f 66 20 74 | 68 65 20 54 48 49 4e 4b |ece of t|he THINK|
|00004130| 20 43 20 64 65 76 69 63 | 65 20 64 72 69 76 65 72 | C devic|e driver|
|00004140| 20 67 6c 75 65 0d 20 2a | 09 74 68 61 74 20 68 61 | glue. *|.that ha|
|00004150| 73 20 62 65 65 6e 20 63 | 6f 6d 70 69 6c 65 64 20 |s been c|ompiled |
|00004160| 69 6e 74 6f 20 74 68 65 | 20 64 72 69 76 65 72 20 |into the| driver |
|00004170| 63 6f 64 65 2e 20 54 68 | 65 20 63 61 6c 6c 20 74 |code. Th|e call t|
|00004180| 6f 20 5f 47 65 74 52 65 | 73 6f 75 72 63 65 0d 20 |o _GetRe|source. |
|00004190| 2a 09 74 68 61 74 20 72 | 65 74 72 69 65 76 65 73 |*.that r|etrieves|
|000041a0| 20 74 68 65 20 64 72 69 | 76 65 72 27 73 20 6f 77 | the dri|ver's ow|
|000041b0| 6e 65 64 20 72 65 73 6f | 75 72 63 65 73 20 69 73 |ned reso|urces is|
|000041c0| 20 72 65 70 6c 61 63 65 | 64 20 62 79 20 61 20 70 | replace|d by a p|
|000041d0| 72 6f 63 65 64 75 72 65 | 0d 20 2a 09 63 61 6c 6c |rocedure|. *.call|
|000041e0| 20 28 4a 53 52 29 20 74 | 6f 20 73 6f 6d 65 20 6e | (JSR) t|o some n|
|000041f0| 65 77 20 63 6f 64 65 2e | 20 54 68 65 20 70 72 6f |ew code.| The pro|
|00004200| 63 65 64 75 72 65 20 74 | 68 61 74 20 69 73 20 74 |cedure t|hat is t|
|00004210| 6f 20 62 65 20 63 61 6c | 6c 65 64 0d 20 2a 09 69 |o be cal|led. *.i|
|00004220| 6e 73 74 65 61 64 2c 20 | 77 68 69 63 68 20 69 73 |nstead, |which is|
|00004230| 20 63 6f 6d 70 69 6c 65 | 64 20 73 65 70 61 72 61 | compile|d separa|
|00004240| 74 65 6c 79 20 61 6e 64 | 20 6d 75 73 74 20 62 65 |tely and| must be|
|00004250| 20 69 6e 20 74 68 69 73 | 20 72 65 73 6f 75 72 63 | in this| resourc|
|00004260| 65 0d 20 2a 09 66 69 6c | 65 2c 20 69 73 20 6c 6f |e. *.fil|e, is lo|
|00004270| 61 64 65 64 20 69 6e 74 | 6f 20 74 68 65 20 73 79 |aded int|o the sy|
|00004280| 73 74 65 6d 20 68 65 61 | 70 20 61 6e 64 20 69 74 |stem hea|p and it|
|00004290| 73 20 61 64 64 72 65 73 | 73 20 69 73 20 70 61 74 |s addres|s is pat|
|000042a0| 63 68 65 64 20 69 6e 74 | 6f 0d 20 2a 09 74 68 65 |ched int|o. *.the|
|000042b0| 20 64 72 69 76 65 72 20 | 63 6f 64 65 2e 0d 20 2a | driver |code.. *|
|000042c0| 2f 0d 0d 4f 53 45 72 72 | 20 54 68 69 6e 6b 43 68 |/..OSErr| ThinkCh|
|000042d0| 61 6e 67 65 43 6f 64 65 | 28 48 61 6e 64 6c 65 20 |angeCode|(Handle |
|000042e0| 64 72 76 72 48 61 6e 64 | 6c 65 2c 20 50 74 72 20 |drvrHand|le, Ptr |
|000042f0| 63 6f 64 65 50 74 72 2c | 20 52 65 73 54 79 70 65 |codePtr,| ResType|
|00004300| 20 74 68 65 54 79 70 65 | 29 0d 7b 0d 09 4f 53 45 | theType|).{..OSE|
|00004310| 72 72 20 65 72 72 43 6f | 64 65 20 3d 20 6e 6f 45 |rr errCo|de = noE|
|00004320| 72 72 3b 0d 09 43 6f 64 | 65 43 68 75 6e 6b 20 6f |rr;..Cod|eChunk o|
|00004330| 6c 64 43 6f 64 65 2c 20 | 6e 65 77 43 6f 64 65 3b |ldCode, |newCode;|
|00004340| 0d 09 6c 6f 6e 67 20 2a | 63 68 75 6e 6b 50 74 72 |..long *|chunkPtr|
|00004350| 3b 0d 0d 09 2f 2a 20 46 | 69 6c 6c 20 69 6e 20 6f |;.../* F|ill in o|
|00004360| 6c 64 43 6f 64 65 20 77 | 69 74 68 20 77 68 61 74 |ldCode w|ith what|
|00004370| 20 74 68 65 20 54 48 49 | 4e 4b 20 43 20 67 6c 75 | the THI|NK C glu|
|00004380| 65 20 6c 6f 6f 6b 73 20 | 6c 69 6b 65 20 6e 6f 77 |e looks |like now|
|00004390| 20 2a 2f 0d 09 63 68 75 | 6e 6b 50 74 72 20 3d 20 | */..chu|nkPtr = |
|000043a0| 28 6c 6f 6e 67 20 2a 29 | 26 6f 6c 64 43 6f 64 65 |(long *)|&oldCode|
|000043b0| 3b 0d 09 2a 63 68 75 6e | 6b 50 74 72 2b 2b 20 3d |;..*chun|kPtr++ =|
|000043c0| 20 30 78 35 30 46 38 30 | 41 35 45 3b 09 09 2f 2a | 0x50F80|A5E;../*|
|000043d0| 20 53 54 20 52 65 73 4c | 6f 61 64 20 2a 2f 0d 09 | ST ResL|oad */..|
|000043e0| 2a 63 68 75 6e 6b 50 74 | 72 2b 2b 20 3d 20 30 78 |*chunkPt|r++ = 0x|
|000043f0| 35 39 38 46 32 46 33 43 | 3b 09 09 2f 2a 20 53 55 |598F2F3C|;../* SU|
|00004400| 42 51 2e 4c 20 23 34 2c | 41 37 20 3b 20 4d 4f 56 |BQ.L #4,|A7 ; MOV|
|00004410| 45 2e 4c 20 49 6d 6d 2e | 4c 2c 2d 28 41 37 29 20 |E.L Imm.|L,-(A7) |
|00004420| 2a 2f 0d 09 2a 63 68 75 | 6e 6b 50 74 72 2b 2b 20 |*/..*chu|nkPtr++ |
|00004430| 3d 20 74 68 65 54 79 70 | 65 3b 09 09 09 2f 2a 20 |= theTyp|e;.../* |
|00004440| 52 65 73 54 79 70 65 20 | 66 6f 72 20 5f 47 65 74 |ResType |for _Get|
|00004450| 52 65 73 6f 75 72 63 65 | 20 2a 2f 0d 09 2a 63 68 |Resource| */..*ch|
|00004460| 75 6e 6b 50 74 72 2b 2b | 20 3d 20 30 78 33 46 30 |unkPtr++| = 0x3F0|
|00004470| 30 41 39 41 30 3b 09 09 | 2f 2a 20 4d 4f 56 45 2e |0A9A0;..|/* MOVE.|
|00004480| 57 20 44 30 2c 2d 28 41 | 37 29 20 3b 20 5f 47 65 |W D0,-(A|7) ; _Ge|
|00004490| 74 52 65 73 6f 75 72 63 | 65 20 2a 2f 0d 09 2a 28 |tResourc|e */..*(|
|000044a0| 73 68 6f 72 74 20 2a 29 | 63 68 75 6e 6b 50 74 72 |short *)|chunkPtr|
|000044b0| 20 3d 20 30 78 32 30 31 | 46 3b 09 2f 2a 20 4d 4f | = 0x201|F;./* MO|
|000044c0| 56 45 2e 4c 20 28 41 37 | 29 2b 2c 44 30 20 2a 2f |VE.L (A7|)+,D0 */|
|000044d0| 0d 0d 09 2f 2a 20 46 69 | 6c 6c 20 69 6e 20 6e 65 |.../* Fi|ll in ne|
|000044e0| 77 43 6f 64 65 20 77 69 | 74 68 20 77 68 61 74 20 |wCode wi|th what |
|000044f0| 77 65 20 77 61 6e 74 20 | 74 68 65 20 54 48 49 4e |we want |the THIN|
|00004500| 4b 20 43 20 67 6c 75 65 | 20 74 6f 20 6c 6f 6f 6b |K C glue| to look|
|00004510| 20 6c 69 6b 65 20 2a 2f | 0d 09 63 68 75 6e 6b 50 | like */|..chunkP|
|00004520| 74 72 20 3d 20 28 6c 6f | 6e 67 20 2a 29 26 6e 65 |tr = (lo|ng *)&ne|
|00004530| 77 43 6f 64 65 3b 0d 09 | 2a 63 68 75 6e 6b 50 74 |wCode;..|*chunkPt|
|00004540| 72 2b 2b 20 3d 20 30 78 | 35 39 38 46 32 46 33 43 |r++ = 0x|598F2F3C|
|00004550| 3b 09 09 2f 2a 20 53 55 | 42 51 2e 4c 20 23 34 2c |;../* SU|BQ.L #4,|
|00004560| 41 37 20 3b 20 4d 4f 56 | 45 2e 4c 20 49 6d 6d 2e |A7 ; MOV|E.L Imm.|
|00004570| 4c 2c 2d 28 41 37 29 20 | 2a 2f 0d 09 2a 63 68 75 |L,-(A7) |*/..*chu|
|00004580| 6e 6b 50 74 72 2b 2b 20 | 3d 20 74 68 65 54 79 70 |nkPtr++ |= theTyp|
|00004590| 65 3b 09 09 09 2f 2a 20 | 52 65 73 54 79 70 65 20 |e;.../* |ResType |
|000045a0| 66 6f 72 20 74 68 65 20 | 68 61 6e 64 6c 65 20 2a |for the |handle *|
|000045b0| 2f 0d 09 2a 63 68 75 6e | 6b 50 74 72 2b 2b 20 3d |/..*chun|kPtr++ =|
|000045c0| 20 30 78 33 46 30 30 34 | 45 42 39 3b 09 09 2f 2a | 0x3F004|EB9;../*|
|000045d0| 20 4d 4f 56 45 2e 57 20 | 44 30 2c 2d 28 41 37 29 | MOVE.W |D0,-(A7)|
|000045e0| 20 3b 20 4a 53 52 20 49 | 6d 6d 2e 4c 20 2a 2f 0d | ; JSR I|mm.L */.|
|000045f0| 09 2a 63 68 75 6e 6b 50 | 74 72 2b 2b 20 3d 20 28 |.*chunkP|tr++ = (|
|00004600| 6c 6f 6e 67 29 63 6f 64 | 65 50 74 72 3b 09 2f 2a |long)cod|ePtr;./*|
|00004610| 20 43 6f 64 65 20 61 64 | 64 72 65 73 73 20 66 6f | Code ad|dress fo|
|00004620| 72 20 4a 53 52 20 2a 2f | 0d 09 2a 28 73 68 6f 72 |r JSR */|..*(shor|
|00004630| 74 20 2a 29 63 68 75 6e | 6b 50 74 72 20 3d 20 30 |t *)chun|kPtr = 0|
|00004640| 78 32 30 31 46 3b 09 2f | 2a 20 4d 4f 56 45 2e 4c |x201F;./|* MOVE.L|
|00004650| 20 28 41 37 29 2b 2c 44 | 30 20 2a 2f 0d 0d 09 2f | (A7)+,D|0 */.../|
|00004660| 2a 20 53 65 61 72 63 68 | 20 66 6f 72 20 74 68 65 |* Search| for the|
|00004670| 20 61 70 70 72 6f 70 72 | 69 61 74 65 20 63 61 6c | appropr|iate cal|
|00004680| 6c 20 74 6f 20 47 65 74 | 52 65 73 6f 75 72 63 65 |l to Get|Resource|
|00004690| 20 61 6e 64 20 66 69 78 | 20 69 74 20 2a 2f 0d 09 | and fix| it */..|
|000046a0| 69 66 28 4d 75 6e 67 65 | 72 28 64 72 76 72 48 61 |if(Munge|r(drvrHa|
|000046b0| 6e 64 6c 65 2c 20 30 4c | 2c 0d 09 20 20 20 20 20 |ndle, 0L|,.. |
|000046c0| 20 20 20 20 20 26 6f 6c | 64 43 6f 64 65 2c 20 73 | &ol|dCode, s|
|000046d0| 69 7a 65 6f 66 28 43 6f | 64 65 43 68 75 6e 6b 29 |izeof(Co|deChunk)|
|000046e0| 2c 0d 09 20 20 20 20 20 | 20 20 20 20 20 26 6e 65 |,.. | &ne|
|000046f0| 77 43 6f 64 65 2c 20 73 | 69 7a 65 6f 66 28 43 6f |wCode, s|izeof(Co|
|00004700| 64 65 43 68 75 6e 6b 29 | 29 20 3c 20 30 29 0d 09 |deChunk)|) < 0)..|
|00004710| 09 72 65 74 75 72 6e 28 | 70 61 72 61 6d 45 72 72 |.return(|paramErr|
|00004720| 29 3b 0d 09 65 6c 73 65 | 0d 09 09 72 65 74 75 72 |);..else|...retur|
|00004730| 6e 28 6e 6f 45 72 72 29 | 3b 0d 7d 0d 0d 2f 2a 0d |n(noErr)|;.}../*.|
|00004740| 20 2a 09 54 68 69 6e 6b | 41 64 64 52 73 72 63 73 | *.Think|AddRsrcs|
|00004750| 20 61 64 64 73 20 74 68 | 65 20 61 70 70 72 6f 70 | adds th|e approp|
|00004760| 72 69 61 74 65 20 72 65 | 73 6f 75 72 63 65 20 68 |riate re|source h|
|00004770| 61 6e 64 6c 65 28 73 29 | 2c 20 49 44 28 73 29 2c |andle(s)|, ID(s),|
|00004780| 20 61 6e 64 20 61 6e 0d | 20 2a 09 69 6e 64 69 63 | and an.| *.indic|
|00004790| 61 74 6f 72 20 66 6f 72 | 20 74 79 70 65 20 28 30 |ator for| type (0|
|000047a0| 20 66 6f 72 20 44 41 54 | 41 20 61 6e 64 20 31 20 | for DAT|A and 1 |
|000047b0| 66 6f 72 20 44 43 4f 44 | 29 20 74 6f 20 74 68 65 |for DCOD|) to the|
|000047c0| 20 65 6e 64 20 6f 66 20 | 74 68 65 20 63 6f 64 65 | end of |the code|
|000047d0| 0d 20 2a 09 74 68 61 74 | 20 69 73 20 70 61 73 73 |. *.that| is pass|
|000047e0| 65 64 20 69 6e 20 73 6f | 20 74 68 61 74 20 74 68 |ed in so| that th|
|000047f0| 65 79 20 63 61 6e 20 62 | 65 20 66 6f 75 6e 64 20 |ey can b|e found |
|00004800| 77 68 65 6e 20 74 68 65 | 20 63 6f 64 65 20 69 73 |when the| code is|
|00004810| 20 63 61 6c 6c 65 64 2e | 0d 20 2a 2f 0d 0d 4f 53 | called.|. */..OS|
|00004820| 45 72 72 20 54 68 69 6e | 6b 41 64 64 52 73 72 63 |Err Thin|kAddRsrc|
|00004830| 73 28 48 61 6e 64 6c 65 | 20 63 6f 64 65 48 61 6e |s(Handle| codeHan|
|00004840| 64 6c 65 2c 20 52 65 73 | 54 79 70 65 20 74 68 65 |dle, Res|Type the|
|00004850| 54 79 70 65 2c 20 73 68 | 6f 72 74 20 72 73 72 63 |Type, sh|ort rsrc|
|00004860| 49 44 2c 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |ID,. | |
|00004870| 20 20 20 20 20 20 20 20 | 73 68 6f 72 74 20 75 6e | |short un|
|00004880| 69 74 4e 75 6d 29 0d 7b | 0d 09 4f 53 45 72 72 20 |itNum).{|..OSErr |
|00004890| 65 72 72 43 6f 64 65 20 | 3d 20 6e 6f 45 72 72 3b |errCode |= noErr;|
|000048a0| 0d 09 73 68 6f 72 74 20 | 69 6e 64 65 78 3b 0d 09 |..short |index;..|
|000048b0| 52 73 72 63 52 65 63 20 | 72 65 73 52 65 63 3b 0d |RsrcRec |resRec;.|
|000048c0| 09 53 74 72 32 35 35 20 | 72 73 72 63 4e 61 6d 65 |.Str255 |rsrcName|
|000048d0| 3b 0d 09 0d 09 2f 2a 20 | 46 69 6e 64 20 6f 75 74 |;..../* |Find out|
|000048e0| 20 68 6f 77 20 6d 61 6e | 79 20 72 65 73 6f 75 72 | how man|y resour|
|000048f0| 63 65 73 20 6f 66 20 74 | 68 65 20 74 79 70 65 20 |ces of t|he type |
|00004900| 74 68 65 72 65 20 61 72 | 65 20 2a 2f 0d 09 69 6e |there ar|e */..in|
|00004910| 64 65 78 20 3d 20 43 6f | 75 6e 74 31 52 65 73 6f |dex = Co|unt1Reso|
|00004920| 75 72 63 65 73 28 74 68 | 65 54 79 70 65 29 20 2d |urces(th|eType) -|
|00004930| 20 31 3b 0d 09 69 66 28 | 69 6e 64 65 78 20 3c 20 | 1;..if(|index < |
|00004940| 30 29 0d 09 09 72 65 74 | 75 72 6e 28 72 65 73 4e |0)...ret|urn(resN|
|00004950| 6f 74 46 6f 75 6e 64 29 | 3b 0d 09 0d 09 64 6f 20 |otFound)|;....do |
|00004960| 7b 0d 09 09 2f 2a 20 47 | 65 74 20 74 68 65 20 69 |{.../* G|et the i|
|00004970| 6e 64 65 78 65 64 20 72 | 65 73 6f 75 72 63 65 20 |ndexed r|esource |
|00004980| 2a 2f 0d 09 09 65 72 72 | 43 6f 64 65 20 3d 20 47 |*/...err|Code = G|
|00004990| 65 74 31 53 79 73 58 52 | 73 72 63 28 26 72 65 73 |et1SysXR|src(&res|
|000049a0| 52 65 63 2e 72 73 72 63 | 2c 20 74 68 65 54 79 70 |Rec.rsrc|, theTyp|
|000049b0| 65 2c 20 30 2c 20 69 6e | 64 65 78 20 2b 20 31 2c |e, 0, in|dex + 1,|
|000049c0| 20 6e 69 6c 29 3b 0d 09 | 09 69 66 28 65 72 72 43 | nil);..|.if(errC|
|000049d0| 6f 64 65 20 3d 3d 20 6e | 6f 45 72 72 29 20 7b 0d |ode == n|oErr) {.|
|000049e0| 09 09 09 47 65 74 52 65 | 73 49 6e 66 6f 28 72 65 |...GetRe|sInfo(re|
|000049f0| 73 52 65 63 2e 72 73 72 | 63 2c 20 26 72 65 73 52 |sRec.rsr|c, &resR|
|00004a00| 65 63 2e 69 64 2c 20 26 | 74 68 65 54 79 70 65 2c |ec.id, &|theType,|
|00004a10| 20 72 73 72 63 4e 61 6d | 65 29 3b 0d 09 09 09 0d | rsrcNam|e);.....|
|00004a20| 09 09 09 2f 2a 0d 09 09 | 09 20 2a 09 49 66 20 74 |.../*...|. *.If t|
|00004a30| 68 65 20 47 65 74 52 65 | 73 49 6e 66 6f 20 66 61 |he GetRe|sInfo fa|
|00004a40| 69 6c 65 64 20 6f 72 20 | 74 68 65 20 49 44 20 73 |iled or |the ID s|
|00004a50| 61 79 73 20 74 68 61 74 | 20 74 68 69 73 20 69 73 |ays that| this is|
|00004a60| 20 6e 6f 74 0d 09 09 09 | 20 2a 09 6f 77 6e 65 64 | not....| *.owned|
|00004a70| 20 62 79 20 74 68 65 20 | 64 72 69 76 65 72 2c 20 | by the |driver, |
|00004a80| 67 65 74 20 72 69 64 20 | 6f 66 20 74 68 65 20 72 |get rid |of the r|
|00004a90| 65 73 6f 75 72 63 65 2e | 20 4f 74 68 65 72 77 69 |esource.| Otherwi|
|00004aa0| 73 65 0d 09 09 09 20 2a | 09 64 65 74 61 63 68 20 |se.... *|.detach |
|00004ab0| 69 74 2e 0d 09 09 09 20 | 2a 2f 0d 09 09 09 69 66 |it..... |*/....if|
|00004ac0| 28 28 28 65 72 72 43 6f | 64 65 20 3d 20 52 65 73 |(((errCo|de = Res|
|00004ad0| 45 72 72 6f 72 28 29 29 | 20 21 3d 20 6e 6f 45 72 |Error())| != noEr|
|00004ae0| 72 29 20 7c 7c 0d 09 09 | 09 20 20 20 28 28 28 72 |r) ||...|. (((r|
|00004af0| 65 73 52 65 63 2e 69 64 | 20 26 20 30 78 30 46 45 |esRec.id| & 0x0FE|
|00004b00| 30 29 20 3e 3e 20 35 29 | 20 21 3d 20 72 73 72 63 |0) >> 5)| != rsrc|
|00004b10| 49 44 29 29 20 7b 0d 09 | 09 09 09 09 52 65 6c 65 |ID)) {..|....Rele|
|00004b20| 61 73 65 52 65 73 6f 75 | 72 63 65 28 72 65 73 52 |aseResou|rce(resR|
|00004b30| 65 63 2e 72 73 72 63 29 | 3b 0d 09 09 09 7d 20 65 |ec.rsrc)|;....} e|
|00004b40| 6c 73 65 20 7b 0d 09 09 | 09 09 44 65 74 61 63 68 |lse {...|..Detach|
|00004b50| 52 65 73 6f 75 72 63 65 | 28 72 65 73 52 65 63 2e |Resource|(resRec.|
|00004b60| 72 73 72 63 29 3b 0d 09 | 09 09 09 69 66 28 28 65 |rsrc);..|...if((e|
|00004b70| 72 72 43 6f 64 65 20 3d | 20 52 65 73 45 72 72 6f |rrCode =| ResErro|
|00004b80| 72 28 29 29 20 3d 3d 20 | 6e 6f 45 72 72 29 20 7b |r()) == |noErr) {|
|00004b90| 0d 0d 09 09 09 09 09 2f | 2a 20 53 65 74 20 74 68 |......./|* Set th|
|00004ba0| 65 20 73 61 76 65 64 20 | 72 65 73 6f 75 72 63 65 |e saved |resource|
|00004bb0| 20 49 44 20 74 6f 20 77 | 68 61 74 20 69 74 20 22 | ID to w|hat it "|
|00004bc0| 73 68 6f 75 6c 64 22 20 | 62 65 20 2a 2f 0d 09 09 |should" |be */...|
|00004bd0| 09 09 09 72 65 73 52 65 | 63 2e 69 64 20 26 3d 20 |...resRe|c.id &= |
|00004be0| 7e 30 78 30 46 45 30 3b | 0d 09 09 09 09 09 72 65 |~0x0FE0;|......re|
|00004bf0| 73 52 65 63 2e 69 64 20 | 7c 3d 20 28 75 6e 69 74 |sRec.id ||= (unit|
|00004c00| 4e 75 6d 20 3c 3c 20 35 | 29 3b 0d 09 09 09 09 09 |Num << 5|);......|
|00004c10| 72 65 73 52 65 63 2e 74 | 79 70 20 3d 20 74 68 65 |resRec.t|yp = the|
|00004c20| 54 79 70 65 3b 0d 09 09 | 09 09 09 0d 09 09 09 09 |Type;...|........|
|00004c30| 09 2f 2a 20 41 64 64 20 | 74 68 65 20 68 61 6e 64 |./* Add |the hand|
|00004c40| 6c 65 20 74 6f 20 74 68 | 65 20 65 6e 64 20 6f 66 |le to th|e end of|
|00004c50| 20 74 68 65 20 63 6f 64 | 65 20 2a 2f 0d 09 09 09 | the cod|e */....|
|00004c60| 09 09 65 72 72 43 6f 64 | 65 20 3d 20 50 74 72 41 |..errCod|e = PtrA|
|00004c70| 6e 64 48 61 6e 64 28 26 | 72 65 73 52 65 63 2c 20 |ndHand(&|resRec, |
|00004c80| 63 6f 64 65 48 61 6e 64 | 6c 65 2c 0d 09 09 09 09 |codeHand|le,.....|
|00004c90| 09 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00004ca0| 20 20 20 20 20 20 73 69 | 7a 65 6f 66 28 72 65 73 | si|zeof(res|
|00004cb0| 52 65 63 29 29 3b 0d 09 | 09 09 09 09 69 66 28 65 |Rec));..|....if(e|
|00004cc0| 72 72 43 6f 64 65 20 21 | 3d 20 6e 6f 45 72 72 29 |rrCode !|= noErr)|
|00004cd0| 0d 09 09 09 09 09 09 44 | 69 73 70 6f 73 48 61 6e |.......D|isposHan|
|00004ce0| 64 6c 65 28 72 65 73 52 | 65 63 2e 72 73 72 63 29 |dle(resR|ec.rsrc)|
|00004cf0| 3b 0d 09 09 09 09 7d 20 | 65 6c 73 65 20 7b 0d 09 |;.....} |else {..|
|00004d00| 09 09 09 09 52 65 6c 65 | 61 73 65 52 65 73 6f 75 |....Rele|aseResou|
|00004d10| 72 63 65 28 72 65 73 52 | 65 63 2e 72 73 72 63 29 |rce(resR|ec.rsrc)|
|00004d20| 3b 0d 09 09 09 09 7d 0d | 09 09 09 7d 0d 09 09 7d |;.....}.|...}...}|
|00004d30| 0d 09 7d 20 77 68 69 6c | 65 28 28 65 72 72 43 6f |..} whil|e((errCo|
|00004d40| 64 65 20 3d 3d 20 6e 6f | 45 72 72 29 20 26 26 20 |de == no|Err) && |
|00004d50| 28 2d 2d 69 6e 64 65 78 | 20 21 3d 20 2d 31 29 29 |(--index| != -1))|
|00004d60| 3b 0d 09 0d 09 72 65 74 | 75 72 6e 28 65 72 72 43 |;....ret|urn(errC|
|00004d70| 6f 64 65 29 3b 0d 7d 0d | 0d 2f 2a 0d 20 2a 09 54 |ode);.}.|./*. *.T|
|00004d80| 68 69 6e 6b 43 6c 65 61 | 6e 75 70 20 67 65 74 73 |hinkClea|nup gets|
|00004d90| 20 72 69 64 20 6f 66 20 | 74 68 65 20 54 48 49 4e | rid of |the THIN|
|00004da0| 4b 20 43 20 64 65 74 61 | 63 68 65 64 20 72 65 73 |K C deta|ched res|
|00004db0| 6f 75 72 63 65 73 2e 0d | 20 2a 2f 0d 0d 76 6f 69 |ources..| */..voi|
|00004dc0| 64 20 54 68 69 6e 6b 43 | 6c 65 61 6e 75 70 28 48 |d ThinkC|leanup(H|
|00004dd0| 61 6e 64 6c 65 20 64 72 | 76 72 48 61 6e 64 6c 65 |andle dr|vrHandle|
|00004de0| 2c 20 42 6f 6f 6c 65 61 | 6e 20 72 6d 76 44 41 54 |, Boolea|n rmvDAT|
|00004df0| 41 29 0d 7b 0d 09 43 6f | 64 65 43 68 75 6e 6b 20 |A).{..Co|deChunk |
|00004e00| 6e 65 77 43 6f 64 65 2c | 20 2a 64 72 76 72 43 68 |newCode,| *drvrCh|
|00004e10| 75 6e 6b 3b 0d 09 6c 6f | 6e 67 20 63 6f 64 65 4f |unk;..lo|ng codeO|
|00004e20| 66 66 73 65 74 20 3d 20 | 30 4c 2c 20 63 6f 64 65 |ffset = |0L, code|
|00004e30| 53 69 7a 65 2c 20 2a 63 | 68 75 6e 6b 50 74 72 3b |Size, *c|hunkPtr;|
|00004e40| 0d 09 50 74 72 20 63 6f | 64 65 50 74 72 20 3d 20 |..Ptr co|dePtr = |
|00004e50| 6e 69 6c 3b 0d 0d 09 2f | 2a 20 46 69 6c 6c 20 69 |nil;.../|* Fill i|
|00004e60| 6e 20 6e 65 77 43 6f 64 | 65 20 77 69 74 68 20 77 |n newCod|e with w|
|00004e70| 68 61 74 20 74 68 65 20 | 66 69 78 65 64 20 54 48 |hat the |fixed TH|
|00004e80| 49 4e 4b 20 43 20 67 6c | 75 65 20 6c 6f 6f 6b 73 |INK C gl|ue looks|
|00004e90| 20 6c 69 6b 65 20 2a 2f | 0d 09 63 68 75 6e 6b 50 | like */|..chunkP|
|00004ea0| 74 72 20 3d 20 28 6c 6f | 6e 67 20 2a 29 26 6e 65 |tr = (lo|ng *)&ne|
|00004eb0| 77 43 6f 64 65 3b 0d 09 | 2a 63 68 75 6e 6b 50 74 |wCode;..|*chunkPt|
|00004ec0| 72 2b 2b 20 3d 20 30 78 | 35 39 38 46 32 46 33 43 |r++ = 0x|598F2F3C|
|00004ed0| 3b 09 09 2f 2a 20 53 55 | 42 51 2e 4c 20 23 34 2c |;../* SU|BQ.L #4,|
|00004ee0| 41 37 20 3b 20 4d 4f 56 | 45 2e 4c 20 49 6d 6d 2e |A7 ; MOV|E.L Imm.|
|00004ef0| 4c 2c 2d 28 41 37 29 20 | 2a 2f 0d 09 2a 63 68 75 |L,-(A7) |*/..*chu|
|00004f00| 6e 6b 50 74 72 2b 2b 20 | 3d 20 27 44 41 54 41 27 |nkPtr++ |= 'DATA'|
|00004f10| 3b 09 09 09 2f 2a 20 52 | 65 73 54 79 70 65 20 66 |;.../* R|esType f|
|00004f20| 6f 72 20 74 68 65 20 68 | 61 6e 64 6c 65 20 2a 2f |or the h|andle */|
|00004f30| 0d 09 2a 63 68 75 6e 6b | 50 74 72 2b 2b 20 3d 20 |..*chunk|Ptr++ = |
|00004f40| 30 78 33 46 30 30 34 45 | 42 39 3b 09 09 2f 2a 20 |0x3F004E|B9;../* |
|00004f50| 4d 4f 56 45 2e 57 20 44 | 30 2c 2d 28 41 37 29 20 |MOVE.W D|0,-(A7) |
|00004f60| 3b 20 4a 53 52 20 49 6d | 6d 2e 4c 20 2a 2f 0d 09 |; JSR Im|m.L */..|
|00004f70| 2a 63 68 75 6e 6b 50 74 | 72 2b 2b 20 3d 20 30 4c |*chunkPt|r++ = 0L|
|00004f80| 3b 09 09 09 09 2f 2a 20 | 43 6f 64 65 20 61 64 64 |;..../* |Code add|
|00004f90| 72 65 73 73 20 66 6f 72 | 20 4a 53 52 20 2a 2f 0d |ress for| JSR */.|
|00004fa0| 09 2a 28 73 68 6f 72 74 | 20 2a 29 63 68 75 6e 6b |.*(short| *)chunk|
|00004fb0| 50 74 72 20 3d 20 30 78 | 32 30 31 46 3b 09 2f 2a |Ptr = 0x|201F;./*|
|00004fc0| 20 4d 4f 56 45 2e 4c 20 | 28 41 37 29 2b 2c 44 30 | MOVE.L |(A7)+,D0|
|00004fd0| 20 2a 2f 0d 0d 09 63 6f | 64 65 53 69 7a 65 20 3d | */...co|deSize =|
|00004fe0| 20 73 69 7a 65 6f 66 28 | 6e 65 77 43 6f 64 65 29 | sizeof(|newCode)|
|00004ff0| 20 2d 0d 09 20 20 20 20 | 20 20 20 20 20 20 20 28 | -.. | (|
|00005000| 73 69 7a 65 6f 66 28 6e | 65 77 43 6f 64 65 2e 70 |sizeof(n|ewCode.p|
|00005010| 33 29 20 2b 20 73 69 7a | 65 6f 66 28 6e 65 77 43 |3) + siz|eof(newC|
|00005020| 6f 64 65 2e 69 6e 73 74 | 37 29 29 3b 0d 0d 09 2f |ode.inst|7));.../|
|00005030| 2a 20 4c 6f 6f 6b 20 66 | 6f 72 20 61 6e 20 6f 63 |* Look f|or an oc|
|00005040| 63 75 72 61 6e 63 65 20 | 6f 66 20 22 66 69 78 65 |curance |of "fixe|
|00005050| 64 22 20 64 72 69 76 65 | 72 20 67 6c 75 65 20 2a |d" drive|r glue *|
|00005060| 2f 0d 09 64 6f 20 7b 0d | 09 09 63 6f 64 65 4f 66 |/..do {.|..codeOf|
|00005070| 66 73 65 74 20 3d 20 4d | 75 6e 67 65 72 28 64 72 |fset = M|unger(dr|
|00005080| 76 72 48 61 6e 64 6c 65 | 2c 20 63 6f 64 65 4f 66 |vrHandle|, codeOf|
|00005090| 66 73 65 74 2c 20 26 6e | 65 77 43 6f 64 65 2c 0d |fset, &n|ewCode,.|
|000050a0| 09 09 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |.. | |
|000050b0| 20 20 20 20 20 20 63 6f | 64 65 53 69 7a 65 2c 20 | co|deSize, |
|000050c0| 6e 69 6c 2c 20 30 29 3b | 0d 09 09 0d 09 09 2f 2a |nil, 0);|....../*|
|000050d0| 20 49 66 20 77 65 20 66 | 6f 75 6e 64 20 73 6f 6d | If we f|ound som|
|000050e0| 65 74 68 69 6e 67 20 2e | 2e 2e 20 2a 2f 0d 09 09 |ething .|.. */...|
|000050f0| 69 66 28 63 6f 64 65 4f | 66 66 73 65 74 20 3e 3d |if(codeO|ffset >=|
|00005100| 20 30 29 20 7b 0d 0d 09 | 09 09 64 72 76 72 43 68 | 0) {...|..drvrCh|
|00005110| 75 6e 6b 20 3d 20 28 43 | 6f 64 65 43 68 75 6e 6b |unk = (C|odeChunk|
|00005120| 20 2a 29 2a 64 72 76 72 | 48 61 6e 64 6c 65 20 2b | *)*drvr|Handle +|
|00005130| 20 63 6f 64 65 4f 66 66 | 73 65 74 3b 0d 09 09 09 | codeOff|set;....|
|00005140| 0d 09 09 09 2f 2a 20 4d | 61 6b 65 20 73 75 72 65 |..../* M|ake sure|
|00005150| 20 74 68 65 20 6c 61 73 | 74 20 69 6e 73 74 72 75 | the las|t instru|
|00005160| 63 74 69 6f 6e 20 6d 61 | 74 63 68 65 73 20 2a 2f |ction ma|tches */|
|00005170| 0d 09 09 09 69 66 28 64 | 72 76 72 43 68 75 6e 6b |....if(d|rvrChunk|
|00005180| 2d 3e 69 6e 73 74 37 20 | 3d 3d 20 6e 65 77 43 6f |->inst7 |== newCo|
|00005190| 64 65 2e 69 6e 73 74 37 | 29 0d 09 09 09 09 63 6f |de.inst7|).....co|
|000051a0| 64 65 50 74 72 20 3d 20 | 64 72 76 72 43 68 75 6e |dePtr = |drvrChun|
|000051b0| 6b 2d 3e 70 33 2e 63 6f | 64 65 50 74 72 3b 0d 09 |k->p3.co|dePtr;..|
|000051c0| 09 09 09 0d 09 09 7d 0d | 09 7d 20 77 68 69 6c 65 |......}.|.} while|
|000051d0| 28 28 63 6f 64 65 50 74 | 72 20 3d 3d 20 6e 69 6c |((codePt|r == nil|
|000051e0| 29 20 26 26 20 28 63 6f | 64 65 4f 66 66 73 65 74 |) && (co|deOffset|
|000051f0| 20 3e 3d 20 30 29 29 3b | 0d 09 0d 09 69 66 28 63 | >= 0));|....if(c|
|00005200| 6f 64 65 50 74 72 20 21 | 3d 20 6e 69 6c 29 20 7b |odePtr !|= nil) {|
|00005210| 09 09 0d 09 09 54 68 69 | 6e 6b 52 6d 76 52 73 72 |.....Thi|nkRmvRsr|
|00005220| 63 73 28 63 6f 64 65 50 | 74 72 2c 20 66 61 6c 73 |cs(codeP|tr, fals|
|00005230| 65 2c 20 72 6d 76 44 41 | 54 41 29 3b 0d 09 09 44 |e, rmvDA|TA);...D|
|00005240| 69 73 70 6f 73 50 74 72 | 28 63 6f 64 65 50 74 72 |isposPtr|(codePtr|
|00005250| 29 3b 0d 09 7d 0d 7d 0d | 0d 2f 2a 0d 20 2a 09 54 |);..}.}.|./*. *.T|
|00005260| 68 69 6e 6b 52 6d 76 52 | 73 72 63 73 20 64 69 73 |hinkRmvR|srcs dis|
|00005270| 70 6f 73 65 73 20 6f 66 | 20 74 68 65 20 68 61 6e |poses of| the han|
|00005280| 64 6c 65 73 20 61 74 74 | 61 63 68 65 64 20 74 6f |dles att|ached to|
|00005290| 20 74 68 65 20 65 6e 64 | 20 6f 66 20 74 68 65 20 | the end| of the |
|000052a0| 63 6f 64 65 0d 20 2a 09 | 70 6f 69 6e 74 65 72 20 |code. *.|pointer |
|000052b0| 28 75 6e 6c 65 73 73 20 | 74 68 65 20 68 61 6e 64 |(unless |the hand|
|000052c0| 6c 65 20 69 73 20 6d 61 | 72 6b 65 64 20 61 73 20 |le is ma|rked as |
|000052d0| 74 68 65 20 44 41 54 41 | 20 72 65 73 6f 75 72 63 |the DATA| resourc|
|000052e0| 65 20 68 61 73 20 61 6c | 72 65 61 64 79 0d 20 2a |e has al|ready. *|
|000052f0| 09 62 65 65 6e 20 64 69 | 73 70 6f 73 65 64 20 6f |.been di|sposed o|
|00005300| 66 20 62 79 20 74 68 65 | 20 64 72 69 76 65 72 20 |f by the| driver |
|00005310| 67 6c 75 65 29 20 61 6e | 64 20 73 65 74 73 20 74 |glue) an|d sets t|
|00005320| 68 65 6d 20 74 6f 20 6e | 69 6c 2e 0d 20 2a 2f 0d |hem to n|il.. */.|
|00005330| 0d 76 6f 69 64 20 54 68 | 69 6e 6b 52 6d 76 52 73 |.void Th|inkRmvRs|
|00005340| 72 63 73 28 50 74 72 20 | 63 6f 64 65 50 74 72 2c |rcs(Ptr |codePtr,|
|00005350| 20 42 6f 6f 6c 65 61 6e | 20 69 73 48 61 6e 64 6c | Boolean| isHandl|
|00005360| 65 2c 20 42 6f 6f 6c 65 | 61 6e 20 72 6d 76 44 41 |e, Boole|an rmvDA|
|00005370| 54 41 29 0d 7b 0d 09 53 | 69 7a 65 20 63 6f 64 65 |TA).{..S|ize code|
|00005380| 53 69 7a 65 3b 0d 09 52 | 73 72 63 52 65 63 20 2a |Size;..R|srcRec *|
|00005390| 72 65 73 50 74 72 3b 0d | 09 0d 09 69 66 28 69 73 |resPtr;.|...if(is|
|000053a0| 48 61 6e 64 6c 65 29 0d | 09 09 63 6f 64 65 53 69 |Handle).|..codeSi|
|000053b0| 7a 65 20 3d 20 47 65 74 | 48 61 6e 64 6c 65 53 69 |ze = Get|HandleSi|
|000053c0| 7a 65 28 52 65 63 6f 76 | 65 72 48 61 6e 64 6c 65 |ze(Recov|erHandle|
|000053d0| 28 63 6f 64 65 50 74 72 | 29 29 3b 0d 09 65 6c 73 |(codePtr|));..els|
|000053e0| 65 0d 09 09 63 6f 64 65 | 53 69 7a 65 20 3d 20 47 |e...code|Size = G|
|000053f0| 65 74 50 74 72 53 69 7a | 65 28 63 6f 64 65 50 74 |etPtrSiz|e(codePt|
|00005400| 72 29 3b 0d 0d 09 2f 2a | 20 46 69 6e 64 20 74 68 |r);.../*| Find th|
|00005410| 65 20 65 6e 64 20 6f 66 | 20 74 68 65 20 63 6f 64 |e end of| the cod|
|00005420| 65 20 72 65 73 6f 75 72 | 63 65 20 61 6e 64 20 77 |e resour|ce and w|
|00005430| 6f 72 6b 20 62 61 63 6b | 20 75 6e 74 69 6c 20 64 |ork back| until d|
|00005440| 6f 6e 65 20 2a 2f 0d 09 | 72 65 73 50 74 72 20 3d |one */..|resPtr =|
|00005450| 20 28 52 73 72 63 52 65 | 63 20 2a 29 28 63 6f 64 | (RsrcRe|c *)(cod|
|00005460| 65 50 74 72 20 2b 20 63 | 6f 64 65 53 69 7a 65 29 |ePtr + c|odeSize)|
|00005470| 3b 0d 09 77 68 69 6c 65 | 28 28 2d 2d 72 65 73 50 |;..while|((--resP|
|00005480| 74 72 29 2d 3e 72 73 72 | 63 20 21 3d 20 6e 69 6c |tr)->rsr|c != nil|
|00005490| 29 20 7b 0d 09 09 69 66 | 28 72 6d 76 44 41 54 41 |) {...if|(rmvDATA|
|000054a0| 20 7c 7c 20 72 65 73 50 | 74 72 2d 3e 74 79 70 20 | || resP|tr->typ |
|000054b0| 21 3d 20 27 44 41 54 41 | 27 29 0d 09 09 09 44 69 |!= 'DATA|')....Di|
|000054c0| 73 70 6f 73 48 61 6e 64 | 6c 65 28 72 65 73 50 74 |sposHand|le(resPt|
|000054d0| 72 2d 3e 72 73 72 63 29 | 3b 0d 09 09 72 65 73 50 |r->rsrc)|;...resP|
|000054e0| 74 72 2d 3e 72 73 72 63 | 20 3d 20 6e 69 6c 3b 0d |tr->rsrc| = nil;.|
|000054f0| 09 7d 0d 7d 00 00 00 00 | 00 00 00 00 00 00 00 00 |.}.}....|........|
|00005500| 00 00 01 00 00 00 04 4a | 00 00 03 4a 00 00 00 ca |.......J|...J....|
|00005510| 73 65 40 70 73 79 63 68 | 2e 75 69 75 63 2e 65 64 |se@psych|.uiuc.ed|
|00005520| 75 3e 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |u>......|........|
|00005530| 08 64 72 69 76 65 72 2e | 63 00 02 00 00 00 50 61 |.driver.|c.....Pa|
|00005540| 72 74 53 49 54 78 00 00 | 00 00 00 00 00 00 00 01 |rtSITx..|........|
|00005550| 00 00 50 61 72 74 53 49 | 54 78 00 00 00 00 00 00 |..PartSI|Tx......|
|00005560| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005570| 00 00 a9 80 18 34 00 00 | 00 00 00 00 05 14 00 10 |.....4..|........|
|00005580| 00 00 00 13 00 00 00 00 | 00 00 00 02 be b9 00 00 |........|........|
|00005590| 09 38 00 00 03 44 02 10 | 20 32 20 4f 63 74 20 31 |.8...D..| 2 Oct 1|
|000055a0| 35 3a 33 32 20 43 44 54 | 00 44 54 00 44 54 00 20 |5:32 CDT|.DT.DT. |
|000055b0| 43 44 54 00 00 00 00 00 | a5 0f 98 7d 00 00 00 00 |CDT.....|...}....|
|000055c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000055d0| 00 00 00 00 00 00 00 00 | 10 4d 65 6c 61 6e 69 65 |........|.Melanie|
|000055e0| 20 41 6e 64 65 72 73 6f | 6e 00 61 6e 69 65 20 41 | Anderso|n.anie A|
|000055f0| 6e 64 65 72 73 6f 6e 29 | 00 00 00 00 00 00 00 00 |nderson)|........|
|00005600| 00 00 00 0a 00 50 00 07 | 01 2c 01 f7 00 12 00 00 |.....P..|.,......|
|00005610| 00 18 00 01 00 16 00 00 | 0f 83 00 6a 00 1d 95 d6 |........|...j....|
|00005620| 00 00 07 65 72 72 43 6f | 64 65 00 00 00 1e 00 00 |...errCo|de......|
|00005630| 13 3b 00 8a 00 00 00 00 | 00 00 34 9d ff ff 00 00 |.;......|..4.....|
|00005640| 00 00 00 00 34 9b ff ff | 00 00 00 00 00 00 00 e2 |....4...|........|
|00005650| 00 07 00 16 00 00 0d 1a | 00 52 00 1d 96 0e 00 00 |........|.R......|
|00005660| 07 65 72 72 43 6f 64 65 | 00 16 00 00 0d 1a 00 52 |.errCode|.......R|
|00005670| 00 1d 95 fe 00 00 07 52 | 65 73 45 72 72 20 00 16 |.......R|esErr ..|
|00005680| 00 00 0d 1a 00 52 00 1d | 95 e6 00 00 07 4d 65 6d |.....R..|.....Mem|
|00005690| 45 72 72 20 00 2e 00 00 | 40 7b 02 12 00 1d 95 52 |Err ....|@{.....R|
|000056a0| 80 00 00 24 00 9e 00 b7 | 01 4d 94 20 00 00 00 00 |...$....|.M. ....|
|000056b0| 00 01 00 01 00 04 0b 72 | 65 73 4c 69 73 74 5b 30 |.......r|esList[0|
|000056c0| 5d 20 00 2e 00 00 40 7b | 02 12 00 1d 95 42 80 00 |] ....@{|.....B..|
|000056d0| 00 25 ff f3 00 b8 00 a2 | 94 20 00 00 00 00 00 01 |.%......|. ......|
|000056e0| 00 01 00 04 0b 72 65 73 | 4c 69 73 74 5b 31 5d 20 |.....res|List[1] |
|000056f0| 00 26 00 00 40 7b 02 12 | 00 1d 95 d6 50 10 00 94 |.&..@{..|....P...|
|00005700| 01 46 01 27 01 f5 94 20 | 00 00 00 00 00 10 07 72 |.F.'... |.......r|
|00005710| 65 73 4c 69 73 74 00 1c | 00 00 40 7b 02 12 00 1d |esList..|..@{....|
|00005720| 95 5a 00 00 0d 2a 67 65 | 74 52 65 73 50 61 74 63 |.Z...*ge|tResPatc|
|00005730| 68 20 00 00 00 0a 00 00 | 38 b6 ff ff 00 00 00 00 |h ......|8.......|
|00005740| 00 00 00 a8 00 06 00 1a | 00 00 4d 3d 02 79 00 1d |........|..M=.y..|
|00005750| 9a b8 00 00 0b 63 6f 64 | 65 4f 66 66 73 65 74 20 |.....cod|eOffset |
|00005760| 00 1a 00 00 4d 3d 02 79 | 00 1d 9a a8 00 00 0b 2a |....M=.y|.......*|
|00005770| 64 72 76 72 48 61 6e 64 | 6c 65 00 1a 00 00 42 43 |drvrHand|le....BC|
|00005780| 02 1d 00 1d 9b a4 00 00 | 0b 64 72 76 72 48 61 6e |........|.drvrHan|
|00005790| 64 6c 65 20 00 28 00 00 | 4d 3d 02 79 00 1d 9a 88 |dle .(..|M=.y....|
|000057a0| 00 00 19 2a 64 72 76 72 | 48 61 6e 64 6c 65 20 2b |...*drvr|Handle +|
|000057b0| 20 63 6f 64 65 4f 66 66 | 73 65 74 20 00 1a 00 00 | codeOff|set ....|
|000057c0| 52 b1 02 a7 00 1d 9a 78 | 00 00 0b 63 6f 64 65 48 |R......x|...codeH|
|000057d0| 61 6e 64 6c 65 20 00 16 | 00 00 52 b1 02 a7 00 1d |andle ..|..R.....|
|000057e0| 9a 68 00 00 07 4d 65 6d | 45 72 72 20 00 00 01 46 |.h...Mem|Err ...F|
|000057f0| 00 0c 00 00 0a db 00 00 | 0a eb 15 00 00 00 31 20 |........|......1 |
|00005800| 49 6e 73 74 61 6c 6c 52 | 41 4d 44 72 69 76 65 72 |InstallR|AMDriver|
|00005810| 00 00 15 b6 00 00 15 c5 | 15 00 00 00 32 20 52 65 |........|....2 Re|
|00005820| 6d 6f 76 65 52 41 4d 44 | 72 69 76 65 72 00 00 00 |moveRAMD|river...|
|00005830| 1c 6f 00 00 1c 7c 13 00 | 00 00 33 20 47 65 74 44 |.o...|..|..3 GetD|
|00005840| 72 76 72 52 65 66 4e 75 | 6d 00 00 00 20 e2 00 00 |rvrRefNu|m... ...|
|00005850| 20 ec 0f 00 00 00 34 20 | 47 72 6f 77 55 54 61 62 | .....4 |GrowUTab|
|00005860| 6c 65 00 00 25 19 00 00 | 25 24 11 00 00 00 35 20 |le..%...|%$....5 |
|00005870| 44 72 69 76 65 72 41 76 | 61 69 6c 00 00 00 2e 46 |DriverAv|ail....F|
|00005880| 00 00 2e 52 11 00 00 00 | 36 20 47 65 74 31 53 79 |...R....|6 Get1Sy|
|00005890| 73 58 52 73 72 63 00 00 | 33 00 00 00 33 09 0f 00 |sXRsrc..|3...3...|
|000058a0| 00 00 37 20 50 74 72 49 | 6e 5a 6f 6e 65 00 00 00 |..7 PtrI|nZone...|
|000058b0| 3a 49 00 00 3a 52 0f 00 | 00 00 38 20 54 68 69 6e |:I..:R..|..8 Thin|
|000058c0| 6b 49 6e 69 74 00 00 00 | 42 49 00 00 42 58 15 00 |kInit...|BI..BX..|
|000058d0| 00 00 39 20 54 68 69 6e | 6b 43 68 61 6e 67 65 43 |..9 Thin|kChangeC|
|000058e0| 6f 64 65 00 00 00 47 a4 | 00 00 47 b1 13 00 00 31 |ode...G.|..G....1|
|000058f0| 30 20 54 68 69 6e 6b 41 | 64 64 52 73 72 63 73 00 |0 ThinkA|ddRsrcs.|
|00005900| 00 00 4d 42 00 00 4d 4e | 11 00 00 31 31 20 54 68 |..MB..MN|...11 Th|
|00005910| 69 6e 6b 43 6c 65 61 6e | 75 70 00 00 52 b6 00 00 |inkClean|up..R...|
|00005920| 52 c3 13 00 00 31 32 20 | 54 68 69 6e 6b 52 6d 76 |R....12 |ThinkRmv|
|00005930| 52 73 72 63 73 00 00 00 | 00 04 00 06 00 04 00 00 |Rsrcs...|........|
|00005940| 00 08 00 09 04 43 6f 64 | 65 1a 00 00 01 00 00 00 |.....Cod|e.......|
|00005950| 04 4a 00 00 03 4a 00 00 | 00 ca 00 42 19 8c 0c 7e |.J...J..|...B...~|
|00005960| 00 00 00 1c 00 ba 00 05 | 53 5f 57 50 00 00 00 32 |........|S_WP...2|
|00005970| 44 54 56 55 00 02 00 3e | 42 4b 50 54 00 01 00 62 |DTVU...>|BKPT...b|
|00005980| 4d 50 53 52 00 00 00 7a | 45 54 41 42 00 00 00 86 |MPSR...z|ETAB....|
|00005990| 45 46 4e 54 00 00 00 92 | 2a 16 00 00 00 00 00 00 |EFNT....|*.......|
|000059a0| 00 00 00 00 31 83 ff ff | 00 00 00 0e 00 00 00 00 |....1...|........|
|000059b0| 7a f5 ff ff 00 00 00 4c | 00 00 00 00 46 e1 ff ff |z......L|....F...|
|000059c0| 00 00 01 40 00 00 00 00 | 1b a0 ff ff 00 00 00 2a |...@....|.......*|
|000059d0| 00 00 00 00 1a 38 ff ff | 00 00 01 32 00 00 00 00 |.....8..|...2....|
|000059e0| 03 ef ff ff 00 00 01 ec | 00 00 00 00 03 ec ff ff |........|........|
|000059f0| 00 00 03 36 00 42 17 70 | 03 eb ff ff 00 00 03 3e |...6.B.p|.......>|
|00005a00| 00 42 17 6c 0f 57 69 6e | 64 6f 77 20 50 6f 73 69 |.B.l.Win|dow Posi|
|00005a10| 74 69 6f 6e 00 00 00 00 | 00 00 00 00 00 00 00 00 |tion....|........|
|00005a20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005a30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005a40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005a50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005a60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005a70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+